The following example shows the XML configuration ignoring all @Repository annotations and
using "stub" repositories instead.
<beans>
<context:component-scan base-package="org.example">
<context:include-filter type="regex" expression=".*Stub.*Repository"/>
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Repository"/>
</context:component-scan>
</beans>
可以看看官方说明。 ------解决方案--------------------
include filter估计是只用它include到的,exclude恰好相反 ------解决方案--------------------