开发者

What is the correct syntax to include multiple `context:exclude-filter`s?

What is the correct syntax to inlcude multiple context:exclude-filters?

I'm using this but I don't know if it works:

<?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:excl开发者_运维知识库ude-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>


You can specify multiple includes and excludes as you have done. You can also use filters such as regex to capture multiple packages in one expression. Take a look at the spec: http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch04s12.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜