<!-- 自动扫描,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

相关文章:

  • 2022-01-14
  • 2022-12-23
  • 2021-04-21
  • 2021-09-08
  • 2021-06-08
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-09-06
  • 2021-10-25
  • 2022-12-23
相关资源
相似解决方案