小编Fra*_*mos的帖子

如何在<context:include-filter>和<context:exclude-filter>中使用Spring?

我有几个服务:

  • example.MailService
  • example.LDAPService
  • example.SQLService
  • example.WebService
  • example.ExcelService

@Service注释注释.如何排除除一个以外的所有服务?


例如,我想只使用MailService.我使用以下配置:

<context:component-scan base-package="example">
    <context:include-filter type="aspectj" expression="example..MailService*" />
    <context:exclude-filter type="aspectj" expression="example..*Service*" />
</context:component-scan>
Run Code Online (Sandbox Code Playgroud)

但现在所有服务都被排除在外.

如果存在一个包含MailService的规则,为什么要排除所有服务?

configuration spring

25
推荐指数
3
解决办法
5万
查看次数

标签 统计

configuration ×1

spring ×1