<context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean上面的注解。该标签主要向容器中掩式定的注了 AutowiredAnnotationBeanPostProcessor  CommondAnnotationBeanPostProcessor  PersistenceAnnotationBeanPostProcessor    RequiredAnnotationBeanPostProcessor这四大组件  

          AutowiredAnnotationBeanPostProcessor:主要是使用@AutoWired注解时,必须提前向Spring容器注册这个BeanPostprocessor
  传统的配置方式:<bean class="org.springframework.beans.factory.annotation. AutowiredAnnotationBeanPostProcessor "/>
          CommondAnnotationBeanPostprocessor:主要是使用@Resource、@PostConstruct、@Predestory等注解时,必须提前向Spring容器注册。
 传统配置方式:<bean class="org.springframework.beans.factory.annotation.CommondAnnotationBeanPostprocessor"/>
          PersistenceAnnotationBeanPostProcessor :主要是使用@PersistenceContext注解时,必须提前向Spring容器注册。
 传统配置方式:<bean class="org.springframework.beans.factory.annotation.PersistenceAnnotationBeanPostProcessor"/>
          RequiredAnnotationBeanPostProcessor:主要是使用@Required注解时,必须提前向Spring容器注册。
 传统配置方式:<bean class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor"/>
 

  <context:component-scan>除了具有<context:annotation-config>的功能之外,<context:component-scan>还可以在指定的package下扫描以及注册javabean 。该标签只是向spring容器中注册 AutowiredAnnotationBeanPostProcessor 实例, 该实例可以自动装配具有 @Autowired 和@Resource 、@Inject注解的属性.

  @Service用于标注业务层组件,@Controller用于标注控制层组件(如struts中的action),@Repository用于标注数据访问组件,即DAO组件,而@Component泛指组件,当组件不好归类的时候,我们可以使用这个注解进行标注。

  @Autowired与@Resource都可以用来装配bean。

  

 

最新文章

  1. long和BigDecimal引发的管理思考
  2. LCA倍增算法的错误与模板
  3. jQueryMobile控件之展开与合并
  4. windows下python检查文件是否被其它文件打开.md
  5. nginx 重写 rewrite 基础及实例
  6. 选择Web API还是WCF
  7. HDU 4099 Revenge of Fibonacci(高精度+字典树)
  8. linux系统编程:进程间通信-mmap
  9. [转] React同构思想
  10. runAllManagedModulesForAllRequests 和 invalid url
  11. Sudoku(回溯)
  12. Java并发编程之闭锁CountDownLatch简单介绍
  13. [ An Ac a Day ^_^ ] CodeForces 680A Bear and Five Cards
  14. 用js来实现那些数据结构(栈01)
  15. 部署testlink报错,安装wampserver时提示丢失MSVCR110.dll
  16. css布局-双飞翼布局
  17. 自定义域名访问本地WEB应用
  18. Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-C. Plasticine zebra
  19. python 全栈开发,Day113(方法和函数的区别,yield,反射)
  20. URL的井号

热门文章

  1. TrMemo控件
  2. (转)OpenFire源码学习之十二:HttpBind&amp;Script Syntax
  3. LInux文件基础知识和文件目录操作(二)文件I/O操作
  4. 9. Python函数
  5. GDB结合Bochs调试内核
  6. Haskell语法
  7. Codeforces 1169A Circle Metro
  8. (转载)js调用打印机 打印整体或部分
  9. 前端(十六)—— JavaScript盒子模型、JS动画、DOM、BOM
  10. Hbase时间同步