包扫描的标签:context-component,相关属性说明
- basepackage:用来指定扫描的包路径
- use-default-filters=”true”:默认的过滤器,即默认会扫描 @Controller、@Service、@Repository、@Component 注解
<!-- 组件扫描 -->
<context:component-scan base-package="com.example">
<!-- 除外Controller的类 -->
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>