context:annotation-config和context:component-scan的区别

<context:annotation-config> 和 <context:component-scan>的区别 

<context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过package scanning的方式)上面的注解。 

<context:component-scan>除了具有<context:annotation-config>的功能之外,<context:component-scan>还可以在指定的package下扫描以及注册javabean 。

猜你喜欢

转载自blog.csdn.net/sxj6977380/article/details/80889119