Spring笔记--context:include-filter

来源:互联网 发布:腾讯用的什么编程语言 编辑:程序博客网 时间:2024/05/22 06:38
<context:component-scan base-package="com.zd">        <!-- 配置自己设定的过滤条件 regex包过滤 所有匹配下面的包路径里面的类全部被spring实例化 -->        <context:include-filter type="regex" expression=".*.common.*"/>        <context:include-filter type="regex" expression=".*.aop.*"/>        <!-- 配置自己设定的过滤条件 aspectj类名称过滤 所有继承和扩展自Base的类都被实例化 -->        <context:include-filter type="aspectj" expression="com.zd.epa.base.Base+"/>    </context:component-scan>

context:component-scan base-package:自动扫描的包
context:include-filter过滤器有五种type:

  1. assignable-指定扫描某个接口派生出来的类
  2. annotation-指定扫描使用某个注解的类
  3. aspectj-指定扫描AspectJ表达式相匹配的类
  4. custom-指定扫描自定义的实现了org.springframework.core.type.filter.TypeFilter接口的类
  5. regex-指定扫描符合正则表达式的类
阅读全文
0 0
原创粉丝点击