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>
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: yii 下拉列表多级联动 dropDownList