组件扫描配置
有时候我们并不需要扫描包下所有的注解,即有时我们只需要扫描特定的注解时,我们可以自己组件扫描配置。
- 首先关闭默认的过滤器。
<context:component-scan base-package="包路径" use-default-filters="false">
- 然后指定要扫描的注解。
<context:include-filter
type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
比任何人都要努力