<context:component-scan base-package="com.matt.cloud"/>

bean-context中

spring.handlers文件

http\://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler

public class ContextNamespaceHandler extends NamespaceHandlerSupport {

    public void init() {
registerBeanDefinitionParser("property-placeholder", new PropertyPlaceholderBeanDefinitionParser());
registerBeanDefinitionParser("property-override", new PropertyOverrideBeanDefinitionParser());
registerBeanDefinitionParser("annotation-config", new AnnotationConfigBeanDefinitionParser());
registerBeanDefinitionParser("component-scan", new ComponentScanBeanDefinitionParser());
registerBeanDefinitionParser("load-time-weaver", new LoadTimeWeaverBeanDefinitionParser());
registerBeanDefinitionParser("spring-configured", new SpringConfiguredBeanDefinitionParser());
registerBeanDefinitionParser("mbean-export", new MBeanExportBeanDefinitionParser());
registerBeanDefinitionParser("mbean-server", new MBeanServerBeanDefinitionParser());
} }

NamespaceHandlerSupport类

ComponentScanBeanDefinitionParser类扫描注解

根据配置的路径加载class文件,当配置问空时可以从jar文件中加载class文件

加载Class文件的方式是,解析Class文件,但没有 "类加载" classLoad发生

加载为 ScannedGenericBeanDefinition类

context:component-scan 注解的扫描的更多相关文章

  1. @Component 元注解

    @Component 元注解 这是一个元注解,意思是它可以用于标注其他注解,被它标注的注解和它起到相同或者类似的作用.Spring用它定义了其他具有特定意义的注解如@Controller @Servi ...

  2. [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 ...

  3. Spring异常累计(1)Spring注解与扫描,NoUniqueBeanDefinitionException

    spring中可以使用注解机制,代替传统的在xml中配置一个bean. 如 <pre name="code" class="java">@Compo ...

  4. @component的注解

    1.@controller 控制器(注入服务) 2.@service 服务(注入dao) 3.@repository dao(实现dao访问) 4.@component (把普通pojo实例化到spr ...

  5. 使用jersey 注解包扫描类PackageNamesScanner

    Jersey 中自带一个包扫描,可以是包,或者具体类名 ,扫描的类型是自己定注解类型,实现功能更加大,可以是jar 包 可以是虚拟地址下的 Jersey 主要用来扫描Path Provider 类中同 ...

  6. Spring框架中的org.springframework.context.annotation.Import注解类

    @Import注解的作用和在使用spring的xml配置时用到的<import/>类似.但应注意是@Import在使用时必须要保证能被IOC容器扫描到,所以通常它会和@Configurat ...

  7. 外部jar包 @Service 无法注解无法扫描问题

    在确保spring 配置 无误的情况下,如: <context:component-scan base-package="your.can.pakeage"></ ...

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

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

  9. MyBatis从入门到精通(第9章):Spring集成MyBatis(上)

    MyBatis从入门到精通(第9章):Spring集成MyBatis(上) Spring是一个为了解决企业级Web应用开发过程中面临的复杂性,而被创建的一个非常流行的轻量级框架. mybatis-sp ...

随机推荐

  1. freeRTOS学习二

    临界段,用一句话概括就是一段在执行时不能被中断的代码段. 临界段被打断的情况,一个是系统调度,还有一个就是外部中断. 对临界段的保护就是对中断的开和关. 空闲任务与阻塞延时 xTicksToDelay ...

  2. Linux用户管理重要初始化目录skel案例讲解

    1.  /etc/skel 目录 /etc/skel 的场景作用

  3. 学习笔记:CentOS 7学习之十二:查找命令

    目录 1.which-whereis-locate-grep-find查找命令 1.1 which 1.2 whereis 1.3 locate 1.4 grep 1.5 find命令 2. 命令的判 ...

  4. mybatis报错无法扫描到xml文件

    错误:java.io.IOException: Could not find resource com/xxx/xxxMapper.xml 原因:target目录下没有***.xml文件 解决方法:在 ...

  5. LC 155 Min Stack

    问题描述 Design a stack that supports push, pop, top, and retrieving the minimum element in constant tim ...

  6. mysql内存优化

    一.环境说明: 操作系统:CentOS 6.5 x86_64 数据库:Mysql 5.6.22 服务器:阿里云VPS,32G Mem,0 swap 二.问题情况: 1.某日发现公司线上系统的Mysql ...

  7. Docker——手动创建镜像

    启动一个进入容器: 在阿里云镜像下载一个nginx: 退出容器: 查看 : docker ps -a oldboyedu是用户名 就像githua一样也有用户名 v1是别名 在创建个容器使用刚才创建的 ...

  8. QObject::connect可以对不继承QObject的类也使用信号槽

    #include <QCoreApplication>#include <QDebug>#include <QObject>#include <QThread ...

  9. Java String类和StringBuffer类

    1.String类 用于字符串操作,本质是字符数组char[ ]. String对象的值是不可变的,即当你修改一个String对象的类容,JVM不会改变原来的对象,而是生成一个新String对象. 2 ...

  10. Java多线程(一):线程与进程

    1.线程和进程 1.1 进程 进程是操作系统的概念,我们运行的一个TIM.exe就是一个进程. 进程(Process)是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位 ...