【问题标题】:What is the correct syntax to include multiple `context:exclude-filter`s?包含多个 `context:exclude-filter` 的正确语法是什么?
【发布时间】:2011-07-05 14:16:19
【问题描述】:

包含多个context:exclude-filters 的正确语法是什么?

我正在使用这个,但我不知道它是否有效:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:annotation-config />
    <context:component-scan base-package="com.myapp">
        <context:exclude-filter type="aspectj" expression="com.myapp.components.*"/>
        <context:exclude-filter type="aspectj" expression="com.myapp.batch.*"/>
        <context:exclude-filter type="aspectj" expression="com.myapp.widgets.*"/>
        <context:exclude-filter type="aspectj" expression="com.myapp.tools.*"/>
    </context:component-scan>

    <import resource="applicationContext-data.xml" />
    <import resource="applicationContext-security.xml" />
    <import resource="applicationContext-service.xml" />

</beans>

【问题讨论】:

    标签: java spring spring-mvc aspectj


    【解决方案1】:

    您可以像之前那样指定多个包含和排除。您还可以使用正则表达式等过滤器在一个表达式中捕获多个包。看一下规范:http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch04s12.html

    【讨论】:

      猜你喜欢
      • 2015-02-09
      • 2014-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      • 1970-01-01
      • 1970-01-01
      • 2013-04-25
      相关资源
      最近更新 更多