包扫描的标签:context-component,相关属性说明

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