首页 > 其他 > 详细

ssh之<context:component-scan base-package="com.xx" />

时间:2015-06-29 16:16:58      阅读:193      评论:0      收藏:0      [点我收藏+]
<context:component-scan/> 配置项不但启用了对类包进行扫描以实施注释驱动 Bean 定义的功能,

同时还启用了注释驱动自动注入的功能

( 即还隐式地在内部注册了 AutowiredAnnotationBeanPostProcessor 和 CommonAnnotationBeanPostProcessor ),


因此当使用 <context:component-scan/> 后,就可以将 <context:annotation-config/> 移除了。

 

<context:component-scan/> 的 base-package 属性指定了需要扫描的类包,类包及其递归子包中所有的类都会被处理。


作用就是所有的 hibernate 配置都不用在 hibernate.cfg.xml 里配置了,也不用一大堆的像Employee.hbm.xml,Person.hbm.xml。

 

ssh之<context:component-scan base-package="com.xx" />

原文:http://www.cnblogs.com/binggu/p/4607612.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!