<context:component-scan base-package="com.orm" />
这行代码的意思就是:项目启动的时候自动扫描 com.orm包下的所有类实施注释驱动 Bean 定义的功能,同时还启用了注释驱动自动注入的功能。
并且内部自动启用了注释驱动,这要就省略了:
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" /> 和 CommonAnnotationBeanPostProcessor
所以写了 <context:component-scan base-package="com.orm" /> 就可以将上边两个类注释掉,
其中 base-package 属性指定了需要扫描的类包,类包及其递归子包中所有的类都会被处理。