springmvc 的配置 annotation-config/annotation-drive/ component-scan 区别


1. <context:annotation-config /> 作用隐式的配置注解的加载类,默认的加载了AutowiredAnnotationBeanPostProcessor(autowired) ,@Resource、@PostConstruct、@PreDestroy等
2.<mvc:annotation-driven/> 将reques 请求上面的数据绑定到controller 上
3.<context:component-scan base-package="com.xiao.*" /> 自动扫描某个包下带有注解的类,并进行注解的相关操作,@Autowired 注入bean; 另外也包含了1 中所做的操作
posted @ 2018-01-17 21:01  zero_and_one  阅读(766)  评论(0编辑  收藏  举报