在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
版权声明:本文为博主原创文章,转载请附上博文链接!

最新文章

  1. pip 8 安装
  2. AMD加载器实现笔记(一)
  3. Linux DHCP通过OPTION43为H3C的AP下发AC地址(总结)
  4. hdu 1573 X问题
  5. .net core 中的序列化和反序列化
  6. margin系列之keyword auto
  7. 初识jsp
  8. BZOJ 4034 [HAOI2015]T2(树链剖分)
  9. HTTPS的学习
  10. [LeetCode] Kill Process 结束进程
  11. 支持向量机(SVM)
  12. 136.137.260. Single Number &amp;&amp; 位运算
  13. ZooKeeper集群详细安装教程
  14. tensorflow入门(1):构造线性回归模型
  15. .net如何处理高并发socket,建立高性能健壮的socket服务
  16. Watermelon -- codeforces
  17. ESP32应用程序的内存布局
  18. OutputStream-InputStream-FileOutputStream-FileInputStream-BufferedOutputStream-BufferedInputStream-四种复制方式-单层文件夹复制
  19. redux超易学三篇之一(单独说redux)
  20. fastRPC升级

热门文章

  1. 如何优化Mysql数据库
  2. WebService测试工具介绍及下载
  3. mysql报错排查总结
  4. UVaLive 2531 The K-League (网络流)
  5. Java 原始类型JComboBox的成员JComboBox(E())的调用 未经过检查
  6. Hdu4632 Palindrome subsequence 2017-01-16 11:14 51人阅读 评论(0) 收藏
  7. Android之ubuntu源码开发环境搭建笔记
  8. follow me
  9. Spring容器中bean的生命周期以及关注spring bean对象的后置处理器:BeanPostProcessor(一个接口)
  10. [LeetCode 题解]:Palindrome Number