一篇很不错的文章,看到就是赚到Get....

      https://www.cnblogs.com/leiOOlei/p/3713989.html

说白了 :<context:component-scan> 包含了 <context:annotation-config> 的作用;

<context:annotation-config> 就是开启注解的作用,就是来处理@AutoWrized @Resource 注解的,干巴巴的注解放到哪里,是没什么作用的 ,<context:annotation-config> 就是将

这些注解赋予了生命,生命就是我们spring 注册的bean

  注解本身并不能够做任何事情,它们只是最基本的组成部分,我们需要能够处理这些注解的处理工具来处理这些注解。

    这就是<context:annotation-config> 所做的事情

<context:component-scan> 它不仅包含了<context:annotation-config> 的作用,还具有自动将带有@component,@service,@Repository等注解的对象注册到spring容器中的功能。

在开发中,我们常用的就是 <context:component-scan> 了

Spring <context:annotation-config> 和 <context:component-scan> 区别的更多相关文章

  1. Spring注解详解@Repository、@Component、@Service 和 @Constroller

    概述 注释配置相对于 XML 配置具有很多的优势: 它可以充分利用 Java 的反射机制获取类结构信息,这些信息可以有效减少配置的工作.如使用 JPA 注释配置 ORM 映射时,我们就不需要指定 PO ...

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

    <context:annotation-config> 和 <context:component-scan>的区别 <context:annotation-config& ...

  3. spring 2.5.6 错误:Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher

    在运行一个第三方公司交付的项目的时候, 出现: Caused by: java.lang.IllegalStateException: Context namespace element 'annot ...

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

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

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

    转自:https://www.cnblogs.com/leiOOlei/p/3713989.html <context:annotation-config> 和 <context:c ...

  6. Spring配置之context:annotation与、component-scan以及annotation-driven

    spring boot帮助我们隐藏了大量的细节,有些配置spring boot都是开启的,因此当我们查看遗留项目使用spring时候遇见问题一定细心排查 <!-- context:annotat ...

  7. spring源码分析之<context:component-scan/>vs<annotation-config/>

    1.<context:annotation-config/> xsd中说明: <xsd:element name="annotation-config"> ...

  8. Mingyang.net:org.springframework.context.annotation.ConflictingBeanDefinitionException

    org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean ...

  9. Spring context:component-scan中使用context:include-filter和context:exclude-filter

    Spring context:component-scan中使用context:include-filter和context:exclude-filter XML: <?xml version= ...

  10. 【原创】大叔经验分享(16)Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher

    今天尝试运行一个古老的工程,配置好之后编译通过,结果运行时报错: org.springframework.beans.factory.BeanDefinitionStoreException: Une ...

随机推荐

  1. python中序列化json模块和pickle模块

    内置模块和第三方模块 json模块和pickle 模块(序列化模块) 什么是序列化? 序列化就是将内粗这种的数据类型转成另一种格式 序列化:字典类型——>序列化——>其他格式——>存 ...

  2. linux下安装Tomcat7.0

    1.下载安装文件:Download apache-tomcat-7.0.14.tar.gz        下载1              下载 2.输入命令解压文件:tar - zxvf apach ...

  3. centos7下找不到iptables文件

    最近在centos7下,搭建ftp服务,按照步骤一步一步来,发现 etc/sysconfig/iptables这个文件并不存在,然后去找解决方案, 原文地址:http://blog.csdn.net/ ...

  4. LeetCode OJ 93. Restore IP Addresses

    题目 Given a string containing only digits, restore it by returning all possible valid IP address comb ...

  5. gitbash上使用tree

    gitbash上使用tree vscode从cmd设置gitbash之后,想在使用windows下的tree命令发现运行不了,有两种解决方案. 1,在gitbash上cmd //c tree,就等同c ...

  6. Android DevArt1:假设当前Activity为A,如果这时用户打开一个新的Activity B,那么B的onResume和A的onPause哪个先执行呢?

    问题描述:假设当前Activity为A,如果这时用户打开一个新的Activity B,那么B的onResume和A的onPause哪个先执行呢? GitHub Demo 废话少说,上代码,Activi ...

  7. Nodejs 菜鸟教程学习-创建第一个应用

    注:为了解学习,都是参照http://www.runoob.com/nodejs/nodejs-tutorial.html书写,做下笔记. 对于Nodejs开发来说,在开发一个应用时,我们不仅仅是实现 ...

  8. [转载]FMS Dev Guide学习笔记(验证客户端二)

    一.开发交互式的媒体应用程序 1.使用unique key a. 在客户端ActionScript中创建一个unique key,如下代码所示,unique key的组成为本地电脑时间和一个随机数连接 ...

  9. for嵌套

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  10. 1-keystone 部署

    https://github.com/openstack/keystone 最新版为rocky 1. 进入mysql create database keystone; grant all privi ...