Spring MVC <context:annotation-config> 与 <context:component-scan>

  在MVC的配置文件中,二者常出现,功能相似。简单做个比较

  <context:annotation-config> 用于激活应用上下文中已经注册的bean的注解,无论你的bean是通过什么方式注册的,例如通过<context:component-scan>注册,或者在Spring的application-context.xml中注册。

  如上述已经提及的,<context:component-scan>可以注册bean,同时扫描指定的package中的注解,然后再激活bean上的注解。

  (https://howtodoinjava.com/spring-mvc/spring-mvc-difference-between-contextannotation-config-vs-contextcomponent-scan/)

原文地址:https://www.cnblogs.com/bigbigbigo/p/10147299.html