<context:annotation-config/>spa
<context:component-scan base-package="com.xx" />component
<context:component-scan/>不但啓用了對類包進行掃描以實施註釋驅動
Bean 定義的功能,同時還啓用了註釋驅動自動注入的功能io
(即還隱式地在內部註冊了 AutowiredAnnotationBeanPostProcessor 和 CommonAnnotationBeanPostProcessor,<context:annotation-config/>的功能),sso
所以當使用 <context:component-scan/> 後,就能夠將 <context:annotation-config/> 移除了。
註釋