1、<context:component-scan base-package="*.*" />

该配置隐式注册了多个对注解进行解析的处理器,如:

AutowiredAnnotationBeanPostProcessor      

CommonAnnotationBeanPostProcessor

PersistenceAnnotationBeanPostProcessor    

RequiredAnnotationBeanPostProcessor

其实,注解本身做不了任何事情,和XML一样,只起到配置的作用,主要在于背后强大的处理器

其中就包括了<context:annotation-config/>配置项里面的注解所使用的处理器

所以配置了<context:component-scan base-package="">之后,便无需再配置<context:annotation-config>

2、<mvc:annotation-driven>

就是支持mvc注解的,说白了就是使Controller中可以使用MVC的各种注解。

相关文章:

  • 2021-10-30
  • 2021-12-02
  • 2022-02-22
  • 2022-12-23
  • 2021-07-11
  • 2021-10-28
猜你喜欢
  • 2021-05-18
  • 2022-12-23
  • 2021-11-16
  • 2021-06-03
  • 2021-04-19
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案