<context:annotation-config> 相对于注册
AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、
PersistenceAnnotationBeanPostProcessor 以及 RequiredAnnotationBeanPostProcessor 这 4 个BeanPostProcessor。
支持的注解为: @Required, @Autowired, @PostConstruct 等, 使用了<context:component-scan/> 后就可以将该配置移除。<mvc:annotation-driven/>相当于注册了DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter两个bean,配置一些messageconverter。即解决了@Controller注解的使用前提配置。
本文介绍了Spring框架中通过注解实现的配置方式,包括不同类型的BeanPostProcessor的作用及如何支持@Required、@Autowired等注解。同时解释了<context:component-scan/>的使用,以及<mvc:annotation-driven/>如何简化@Controller注解的配置。
4万+

被折叠的 条评论
为什么被折叠?



