6、spring component-scan扫描 context:exclude-filter 与 context:include-filter

1 在主容器中(applicationContext.xml),将Controller的注解打消掉

<context:component-scan base-package="exampleBean">  
        <context:exclude-filter type="annotation"  
            expression="org.springframework.stereotype.Controller" />  
    </context:component-scan> 

2 在主容器中(applicationContext.xml),按正则过滤指定类

<context:component-scan base-package="exampleBean">  
<!-- 过滤掉exampleBean下的且类名以Default开头的类 -->  
    <context:exclude-filter type="regex"  
        expression="exampleBean\.Default*" />  
</context:component-scan>  

3 在主容器中(applicationContext.xml),按指定类名过滤指定类

<context:component-scan base-package="exampleBean">  
<!-- 过滤掉exampleBean下的类名为<span style="font-family: Arial, Helvetica, sans-serif;">MovieFinder</span>的类 -->  
    <context:exclude-filter type="assignable" expression="exampleBean.MovieFinder"/>  
</context:component-scan>