Spring中的context:annotation-config作用
来源:互联网 发布:.net 微商城源码 编辑:程序博客网 时间:2024/06/05 21:06
使用spring一般都会下面这行配置:
<context:annotation-config/>
他的作用是隐式地向 Spring 容器注册 AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、PersistenceAnnotationBeanPostProcessor、RequiredAnnotationBeanPostProcessor 这4个BeanPostProcessor.
例如:
如果想使用@ Resource 、@ PostConstruct、@ PreDestroy等注解就必须声明CommonAnnotationBeanPostProcessor。
如果想使用@PersistenceContext注解,就必须声明PersistenceAnnotationBeanPostProcessor的Bean。
如果你想使用@Autowired注解,那么就必须事先在 Spring 容器中声明 AutowiredAnnotationBeanPostProcessor Bean。传统声明方式如下:
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor "/>
如果想使用 @Required的注解,就必须声明RequiredAnnotationBeanPostProcessor的Bean。同样,传统的声明方式如下:
<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>
- Spring中的context:annotation-config作用
- Spring中的<context:annotation-config/>
- Spring中<context:annotation-config/>的作用
- 配置Spring <context:annotation-config/>的作用
- Spring <context:annotation-config/> 作用讲解
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- spring <context:annotation-config /> 配置作用
- Spring中<context:annotation-config/>的作用
- Spring中<context:annotation-config/>的作用
- 关于Spring中的<context:annotation-config/>配置
- Spring配置中的<context:annotation-config/>
- spring配置文件中的<context:annotation-config/>
- Spring配置中的<context:annotation-config/>
- 关于Spring中的<context:annotation-config/>配置
- Spring中的<context:annotation-config/>配置
- 关于Spring中的<context:annotation-config/>配置
- Linux必学的60个命令
- SDK演示使用 CreateDirectory
- android SharedPreferences(详解+例子)
- C++ 虚函数表解析
- 品牌类客户如何考核SEM投放效果
- Spring中的context:annotation-config作用
- SDK获取程序所在的目录,程序模块路径,获取和设置当前目录
- Android启动画面
- SilverLight 项目启动报错解决
- 用exchange partition和split partition将表分区。
- AsyncTask的缺陷-异步多任务
- Android 四种launchMode及疑问
- perl --2013-4-8 实量(常量)与print
- 十八个月Android学习工作总结(2013-01-28更新)