"context:annotation-config" and "context:component-scan"
1.<context:annotation-config/>注册多个处理器
<context:annotation-config/>作用是向 Spring 容器注册
AutowiredAnnotationBeanPostProcessor(@Autowired)、
CommonAnnotationBeanPostProcessor(@Resource 、@PostConstruct、@PreDestroy)、
PersistenceAnnotationBeanPostProcessor (@PersistenceContext)
RequiredAnnotationBeanPostProcessor (@Required)
这 4 个BeanPostProcessor。
2.配置<context:component-scan/>更省事
<context:component-scan base-package=”XX.XX”/> 该配置项其实也包含了自动注入上述processor的功能,因此当使用 <context:component-scan/> 后,就可以将 <context:annotation-config/> 移除了。
"context:annotation-config" and "context:component-scan"的更多相关文章
- Mingyang.net:org.springframework.context.annotation.ConflictingBeanDefinitionException
org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean ...
- 【原创】大叔经验分享(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 ...
- 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 ...
- Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException
org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean ...
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser]
严重: Exception sending context initialized event to listener instance of class org.springframework.we ...
- class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
在搭建SSM项目时报了以下的错误: 06-Oct-2019 11:55:52.109 信息 [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina. ...
- [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher 问题--MyEclipse设置JDK版本
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc ...
- Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
异常信息如下: 错误: Unexpected exception parsing XML document from class path resource [spring/applicationCo ...
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher
Context namespace element 'annotation-config' and its parser class [org.springframework.context.anno ...
- Spring配置之context:annotation与、component-scan以及annotation-driven
spring boot帮助我们隐藏了大量的细节,有些配置spring boot都是开启的,因此当我们查看遗留项目使用spring时候遇见问题一定细心排查 <!-- context:annotat ...
随机推荐
- mybatis的selectOne和selectList没有数据返回时的问题
1.使用mybatis的selectList方法,如果数据表中没有数据返回,则返回空集合[ ],而不会返回null,这是mybatis作的封装 @Override public List<Con ...
- Netty《一》
作者:郭无心链接:https://www.zhihu.com/question/24322387/answer/78947405来源:知乎著作权归作者所有,转载请联系作者获得授权. Netty是什么? ...
- Javascript学习笔记--理解prototype
prototype和closure是js中两个不好搞懂的概念,幸好网上有很多相关的文章,在网上查了一遍以后,总是是觉得有点理解了.今天先说说prototype. 之前一直被ajax in action ...
- 【学习笔记】Python基础教程学习笔记
教程视频网盘共享:http://pan.baidu.com/s/1hrTrR5E 03-python基础.if判断 print 输出数据 print("hahahah")----- ...
- spring基础---->请求与响应的参数(一)
这里面我们主要介绍一下spring中关于请求和响应参数数据的问题.爱,从来就是一件千回百转的事.不曾被离弃,不曾受伤害,怎懂得爱人?爱,原来是一种经历. spring中的请求与响应 一.spring中 ...
- 链表一元多项式计算器的实现(Java语言描述)
链表的经典应用,程序在多项式相加同类项合并还有小的瑕疵,有待改进. 代码如下: package 一元多项式计算器; public class PolyNode { private double a; ...
- [转]stetho使用介绍
原文链接:http://www.jianshu.com/p/c03a8959d1a5# 转载请注明来源,尊重作者成果 介绍 stetho是facebook开发的Android调试工具.它可以通过chr ...
- mrtg 和 rrdtools
mrtg可能很多人都用过,但那已经是n久以前的事了,现在在国内很多IDC,ISP都还用这个,因为我们这有个Linux科学家,在Linux工作n 久,我也就沾点光,学了不少东西,现在给大家介绍一个rrd ...
- vue组件定义方式
一.全局组件 <div id="box"> {{msg}} <my-aaa></my-aaa> </div> var Home = ...
- Mysql语句优化
总结总结自己犯过的错,网上说的与自己的Mysql语句优化的想法. 1.查询数据库的语句的字段,尽量做到用多少写多少. 2.建索引,确保查询速度. 3.orm框架自带的方法会损耗一部分性能,这个性能应该 ...