http://blog.csdn.net/w2393040183/article/details/50749851

    <!-- 扫描@Controller注解 --><context:component-scan base-package="com.fq.controller"><context:include-filter type="annotation"expression="org.springframework.stereotype.Controller" /></context:component-scan>

可以看出要把最终的包写上,而不能这样写base-package=”com.fq”。这种写法对于include-filter来讲它都会扫描,而不是仅仅扫描@Controller。哈哈哈,这点需要注意。他一般会导致一个常见的错误,那就是事务不起作用,补救的方法是添加use-default-filters=”false”。

(2)在Spring-Context.xml中有如下配置:

    <!-- 配置扫描注解,不扫描@Controller注解 --><context:component-scan base-package="com.fq"><context:exclude-filter type="annotation"expression="org.springframework.stereotype.Controller" /></context:component-scan>

可以看到,他是要扫描com.fq包下的所有子类,不包含@Controller。对于exculude-filter不存在包不精确后都进行扫描的问题。

转载于:https://www.cnblogs.com/antis/p/7267026.html

spring中的context:include-filter和context:exclude-filter的区别相关推荐

  1. Spring中的@ Component,@ Repository和@Service批注有什么区别?

    @Repository @Component , @Repository和@Service批注可以在Spring中互换使用吗,或者除了充当注解设备外,它们还提供任何特定功能吗? 换句话说,如果我有一个 ...

  2. Spring中@ Component,@ Service,@ Controller和@Repository之间的区别

    在了解Spring框架中@Repository @Component , @Service @Controller , @Repository @Controller和@Repository批注之间的 ...

  3. Spring 中的 context

    Spring 中的 context BeanFactory 首先看下,官方在代码中给出的注释: The root interface for accessing a Spring bean conta ...

  4. 谈谈Spring中的对象跟Bean,你知道Spring怎么创建对象的吗?

    本系列文章: 读源码,我们可以从第一行读起 你知道Spring是怎么解析配置类的吗? 配置类为什么要添加@Configuration注解? 推荐阅读: Spring官网阅读 | 总结篇 Spring杂 ...

  5. 关于Spring中的context:annotation-config/配置(开启注解)

    转自:https://www.cnblogs.com/doudouxiaoye/p/5681518.html 当我们需要使用BeanPostProcessor时,直接在Spring配置文件中定义这些B ...

  6. spring中context:property-placeholder标签详解

    spring中context:property-placeholder标签的使用说明 1,有些参数在某些阶段中是常量. 在开发阶段我们连接数据库时的url,username,password等信息 分 ...

  7. spring cloud连载第一篇之bootstrap context

    1. Spring Cloud Context: Application Context Services(应用上下文服务) 1.1 The Bootstrap Application Context ...

  8. spring中的Filter使用

    Filter何时进行url过滤 filter(过滤器)作用于在intreceptor(拦截器)之前,不像intreceptor一样依赖于springmvc框架,只需要依赖于serverlet. Fil ...

  9. Spring核心组件详解(Bean、Context、Core)

    上篇文章介绍了Spring的有三个核心组件,它们为什么是Spring的核心组件,它们之间啥关系,都代表了啥角色. 下面将详细介绍每个组件内部类的层次关系,以及它们在运行时的时序顺序.我们在使用 Spr ...

  10. Spring中Controller层、Filter层、Interceptor层全局统一异常处理

    Controller层.Filter层.Interceptor层全局统一异常处理 SpringBoot为异常处理提供了很多优秀的方法,但是像我这种新手在处理异常时还是会觉得一头包,终于我痛定思痛,总结 ...

最新文章

  1. 决策树算法详解(2)
  2. Oracle 11.2.0.4 x64 RAC扩展存储空间
  3. HDU1715 大菲波数(大数相加)(Java题解)
  4. CSS Overflow属性详解(转)
  5. 【嵌入式】ARM技术博客汇总
  6. precede和previous_Previous Analyses of Hungarian Phrase Structure
  7. 月份第一天_4月份的第一天,全省迎来晴暖天气~
  8. java instanceof和isInstance的关系 精析
  9. MacBook 显示未连接任何摄影机,视频镜头不能用怎么办?
  10. MS SQL SERVER中的临时表
  11. java 没有junit包,~项目导入时报错:程序包org.junit不存在
  12. html没有注册类,电脑中ie浏览器提示没有注册类别的三种解决方法
  13. 百度与小米在一起了,双方到底想干啥?
  14. android指南针卡死,android指南针
  15. 商务办公用什么邮箱,注册163.net邮箱怎么样
  16. 跳楼撞墙挖地道坐热气球:东德人穿越柏林墙的古怪方法
  17. go 语言的相对路径
  18. July, 8(R)
  19. GAppProxy-2.0.0安装使用手册
  20. 目标检测算法SSD用于行人检测(二):训练和测试SSD网络

热门文章

  1. DE25 Homogeneous Linear Systems with Constant Coefficients
  2. DE20 Derivative Formulas
  3. lightGBM用于排序(Learning to Rank )
  4. 社群数据分析:你运营的社群是好社群吗?
  5. 非极大值抑制_OpenCV非极大值抑制bug
  6. python刚开始什么都不能_关于python的初步学习
  7. 创新方法(TRIZ)理论及应用(一)
  8. 如何让地面不起灰_地面不平怎么办?无沙找平的做法
  9. 如何制作一款HTML5 RPG游戏引擎——第五篇,人物人物特效
  10. vue 将数据保存到vuex中