spring中的context:include-filter和context:exclude-filter的区别
在Spring 的配置文件中有:
<context:component-scan base-package="njupt.dao,njupt.service">
<context:exclude-filter expression="org.springframework.stereotype.Controller"
type="annotation" />
</context:component-scan>
默认use-default-filters="true"所以会自动对 @Component、@ManagedBeuse-default-filters="true"an、@Named注解的Bean进行扫描,context:exclude-filter不对Controller的注解进行扫描。
在SpringMVC的配置文件中有:
<context:component-scan base-package="njupt.mapper"
use-default-filters="false">
<context:include-filter
expression="org.springframework.stereotype.Controller" type="annotation" />
</context:component-scan>
使用use-default-filters="false"不会对 @Component、@ManagedBeuse-default-filters="true"an、@Named注解的Bean进行扫描,context:include-filter对Controler进行扫描。
这样做是有意义的,可以避免事务失效
---------------------
作者:维1
来源:CSDN
原文:https://blog.csdn.net/qq_37859539/article/details/80118186
版权声明:本文为博主原创文章,转载请附上博文链接!
最新文章
- pip 8 安装
- AMD加载器实现笔记(一)
- Linux DHCP通过OPTION43为H3C的AP下发AC地址(总结)
- hdu 1573 X问题
- .net core 中的序列化和反序列化
- margin系列之keyword auto
- 初识jsp
- BZOJ 4034 [HAOI2015]T2(树链剖分)
- HTTPS的学习
- [LeetCode] Kill Process 结束进程
- 支持向量机(SVM)
- 136.137.260. Single Number &;&; 位运算
- ZooKeeper集群详细安装教程
- tensorflow入门(1):构造线性回归模型
- .net如何处理高并发socket,建立高性能健壮的socket服务
- Watermelon -- codeforces
- ESP32应用程序的内存布局
- OutputStream-InputStream-FileOutputStream-FileInputStream-BufferedOutputStream-BufferedInputStream-四种复制方式-单层文件夹复制
- redux超易学三篇之一(单独说redux)
- fastRPC升级
热门文章
- 如何优化Mysql数据库
- WebService测试工具介绍及下载
- mysql报错排查总结
- UVaLive 2531 The K-League (网络流)
- Java 原始类型JComboBox的成员JComboBox(E())的调用 未经过检查
- Hdu4632 Palindrome subsequence 2017-01-16 11:14 51人阅读 评论(0) 收藏
- Android之ubuntu源码开发环境搭建笔记
- follow me
- Spring容器中bean的生命周期以及关注spring bean对象的后置处理器:BeanPostProcessor(一个接口)
- [LeetCode 题解]:Palindrome Number