XML中配置context:component-scan时,spring会自动的扫描这个包下被这些注解标识的类@Component,@Service,@Controller,@Repository,同时自动注册为bean

  同时context:component-scan包含了context:annotation-config的属性开关功能

  具体的属性注册四个BeanPostProcessor:

  AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、

  PersistenceAnnotationBeanPostProcessor 、RequiredAnnotationBeanPostProcessor。

  AutowiredAnnotationBeanPostProcessor的注册对应使用@Autowired注解,

  CommonAnnotationBeanPostProcessor注册对应使用@ Resource 、@ PostConstruct、@ PreDestroy注解,

  PersistenceAnnotationBeanPostProcessor 注册对应使用@PersistenceContext注解,

  RequiredAnnotationBeanPostProcessor注册对应使用@Required注解。

  由于我们一般使用context:component-scan(包含自动注入上方的四个BeanPostProcessor)功能的注解包的扫描,context:annotation-config的存在基本可以忽略了

  context:component-scan的子标签包含了

        <context:exclude-filter type="" expression=""/>
<context:include-filter type="" expression=""/>

  context:exclude-filter:告知哪些类或者接口不需要被扫描

  context:include-filter:告知哪些类或者接口需要被扫描,并注册成bean类

  想到再补充吧


												

context:component-scan标签的诠释的更多相关文章

  1. [Spring Boot] Use Component Scan to scan for Bean

    Component Scan is important concept when we want to create Bean. Currently we know what, for the cla ...

  2. Spring 配置 Annotation <context:annotation-config> 和 <context:component-scan>标签的诠释及区别

    Spring 开启Annotation <context:annotation-config> 和 <context:component-scan>诠释及区别 <cont ...

  3. Django Context对象 + 过滤器 + 标签

    玩一玩上下文(context)对象 多数时间,你可以通过传递一个完全填充(full populated)的字典给 Context() 来初始化 上下文(Context) . 但是初始化以后,你也可以从 ...

  4. <context:component-scan>子标签:<context:include-filter>和<context:exclude-filter>使用时要注意的地方

    在Spring MVC中的配置中一般会遇到这两个标签,作为<context:component-scan>的子标签出现. 但在使用时要注意一下几点: 1.在很多配置中一般都会吧Spring ...

  5. 没有找到<context:component-scan base-package="">标签

    <?xml version="1.0" encoding="UTF-8"?> <!-- 指定Spring配置文件的Schema信息 --> ...

  6. Spring源码系列 — BeanDefinition扩展点

    前言 前文介绍了Spring Bean的生命周期,也算是XML IOC系列的完结.但是Spring的博大精深,还有很多盲点需要摸索.整合前面的系列文章,从Resource到BeanDefinition ...

  7. spring boot2.0

    1. Spring boot 简介 1.1 spring boot的三大特性 组件自动装配:Web mvc, Web Flux,JDBC等 激活:@EnableAutoConfiguration 配置 ...

  8. RESTful Demo

    Demo 功能 两个模块, App 与 Admin, App 模块提供增加用户(/add?name=${name})与查询用户(/query/${id}), Admin 模块提供列出所有用户(/lis ...

  9. SpringMVC_01:创建运行环境(Maven)

    Maven 环境下配置: 1.新建MavenProject,打包选线根据情况选择jar war和pom jar:打包为jar包,主要用于被其他项目引用 war:打包为war包,可直接运行于服务器 po ...

随机推荐

  1. tensorflow在文本处理中的使用——skip-gram & CBOW原理总结

    摘自:http://www.cnblogs.com/pinard/p/7160330.html 先看下列三篇,再理解此篇会更容易些(个人意见) skip-gram,CBOW,Word2Vec 词向量基 ...

  2. CF1209

    CF1209 A B 水题不管 C 因为要求最终整个序列是要单调的 所以我们就考虑枚举断点$x$ 之后把$<x$的数放到第一个集合 把$> x$的数放到第二个集合 至于$=x$的数 他能放 ...

  3. CF 453C. Little Pony and Summer Sun Celebration

    CF 453C. Little Pony and Summer Sun Celebration 构造题. 题目大意,给定一个无向图,每个点必须被指定的奇数或者偶数次,求一条满足条件的路径(长度不超\( ...

  4. Build 2017(简体中文视频)

    视频汇总地址 入口 可筛选某天的视频 部分包含中文字幕 我看过的视频 Day1 #MSBuild Day 1 Keynote(中文字幕) Three Runtimes, one standard… . ...

  5. Your development team, "", does not support the Push Notifications capability.

    问题: Your development team, "", does not support the Push Notifications capability. 解决方法: 1 ...

  6. 如何看Crash 文件

    如何查看崩溃日志 好了,获得是人类可读语言的崩溃日志后,或者是从别人手机到处崩溃日志后,下一步就是查看了.下面就正对一个程序猿该如何看稍微说说. 崩溃日志头     1 2 3 4 5 6 7 8 9 ...

  7. 解析crash

    命令行 1.查找 symbolicatecrash find /Applications/Xcode.app -name symbolicatecrash -type f 2.此时会出现一个路径 sy ...

  8. Google 开源的 Python 命令行库:深入 fire(一)

    作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  9. nginx实现缓存功能

    Nginx从0.7.48版本开始,支持了类似Squid的缓存功能.这个缓存是把URL及相关组合当作Key,用md5编码哈希后保存在硬盘上,所以它可以支持任意URL链接,同时也支持404/301/302 ...

  10. JavaScript之DOM操作,事件操作,节点操作

    1,DOM操作 1.1  概念 所谓DOM,全称Document Object Model 文档对象模型,DOM是W3C(World Wide Web Consortuum )标准,同时也定义了访问诸 ...