<context annotation-config />标签意义
来源:互联网 发布:苏州附近淘宝拿货渠道 编辑:程序博客网 时间:2024/05/09 10:46
<context annotation-config />标签意义:
该标签隐式的向Spring容器注册了:
AutowiredAnnotationBeanPostProcessor CommondAnnotationBeanPostProcessor
PersistenceAnnotationBeanPostProcessor RequiredAnnotationBeanPostProcessor 这四个BeanPostProcessor.
AutowiredAnnotationBeanPostProcessor CommondAnnotationBeanPostProcessor
PersistenceAnnotationBeanPostProcessor RequiredAnnotationBeanPostProcessor 这四个BeanPostProcessor.
1.AutowiredAnnotationBeanPostProcessor:主要是使用@AutoWired注解时,必须提前向Spring容器注册这个BeanPostprocessor
传统的配置方式:<bean class="org.springframework.beans.factory.annotation. AutowiredAnnotationBeanPostProcessor "/>
传统的配置方式:<bean class="org.springframework.beans.factory.annotation. AutowiredAnnotationBeanPostProcessor "/>
2.CommondAnnotationBeanPostprocessor:主要是使用@Resource、@PostConstruct、@Predestory等注解时,必须提前向Spring容器注册。
传统配置方式:<bean class="org.springframework.beans.factory.annotation.CommondAnnotationBeanPostprocessor"/>
传统配置方式:<bean class="org.springframework.beans.factory.annotation.CommondAnnotationBeanPostprocessor"/>
3.PersistenceAnnotationBeanPostProcessor :主要是使用@PersistenceContext注解时,必须提前向Spring容器注册。
传统配置方式:<bean class="org.springframework.beans.factory.annotation.PersistenceAnnotationBeanPostProcessor"/>
传统配置方式:<bean class="org.springframework.beans.factory.annotation.PersistenceAnnotationBeanPostProcessor"/>
4.RequiredAnnotationBeanPostProcessor:主要是使用@Required注解时,必须提前向Spring容器注册。
传统配置方式:<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>
传统配置方式:<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>
一般来说,@Autowired注解比较常用,传统配置方式有点繁琐,而这种隐式配置方式就可以帮我们很容易的搞定。
不过使用注解,我们一般都会配置扫描包路径:<context: component-scan base-package=com.xxx.xxx />
其实,给配置已经包含了自动注入上述Processor的功能,所以,配置了包扫描之后,<context annotation-config />就可以移除了。
不过使用注解,我们一般都会配置扫描包路径:<context: component-scan base-package=com.xxx.xxx />
其实,给配置已经包含了自动注入上述Processor的功能,所以,配置了包扫描之后,<context annotation-config />就可以移除了。
0 0
- <context annotation-config />标签意义
- <context annotation-config />标签意义
- <context annotation-config />标签意义:
- <context annotation-config />标签意义
- <context annotation-config />标签意义:
- <context annotation-config />标签意义:
- <context annotation-config />标签意义
- <context annotation-config />标签意义
- <context annotation-config />标签意义
- <context annotation-config />标签意义:
- <context annotation-config />标签意义:
- context:annotation-config 标签解析
- <context:annotation-config/>
- <context:annotation-config />
- <context:annotation-config/>详解
- spring <context:annotation-config/>
- <context:annotation-config/>
- Spring <context:annotation-config/>
- <mvc:annotation-driven />注解意义
- 【数据结构基础】循环队列
- Mean-shift算法的直观理解
- 花开花落又一年
- Servlet Filter(过滤器)
- <context annotation-config />标签意义
- kali linux ssh
- 柳暗花明又一村
- hdoj 1213 How Many Tables
- oracle12c不能进入到http://localhost:1158/em的解决办法
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- 通才学习之起点2015.01.09
- 华为机试—整数逆序并去重
- Xvid源代码学习