首页 > 编程语言 > 详细

Spring 注解过滤

时间:2017-02-27 13:16:25      阅读:215      评论:0      收藏:0      [点我收藏+]
 
<!-- 自动扫描,base-package 属性指定了需要扫描的类包,类包及其递归子包中所有的类都会被处理-->
    <context:component-scan base-package="com.chen">
 
        <!-- 排除模拟实现类
        <context:exclude-filter type="regex" expression="com.chen.service.mockimpl.*"/>-->
        <!-- 排除真实实现类 -->
        <context:exclude-filter type="regex" expression="com.chen.service.impl.*"/>

         <!-- 排除注解Controller -->
      < context:exclude-filter type= "annotation" expression ="org.springframework.stereotype.Controller"/>
    </context:component-scan>
 
 
Filter Type  Examples Expression  Description
annotation  org.example.SomeAnnotation  符合SomeAnnoation的target class
assignable  org.example.SomeClass  指定class或interface的全名
aspectj  org.example..*Service+  AspectJ語法
regex  org\.example\.Default.*  Regelar Expression
custom org.example.MyTypeFilter  Spring3新增自訂Type,實作  org.springframework.core.type.TypeFilter

Spring 注解过滤

原文:http://www.cnblogs.com/leonkobe/p/6473024.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!