本文共 707 字,大约阅读时间需要 2 分钟。
<!-- 扫描的时候排除一些不要的组件 type="annotation"按照注解进行排除,标了指定注解的组件不要 expression="":注解的全类名 type="assignable":指定排除某个具体的类,按照类排除 type="aspectj":aspectj表达式 type="custom":自动义TypeFilter,自己写代码确定哪些使用 type="regex":则正表达式 --> <context:component-scan base-package="com.atguigu"> <context:exclude-filter type="assignable" expression="com.atguigu.service.BookService"/> </context:component-scan> <!-- 只扫描进入哪些组件,默认都是全部扫描进来 use-default-filters="false:禁止默认规则,默认是全部扫描 --> <context:component-scan base-package="com.atguigu" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan>
转载地址:http://tbze.baihongyu.com/