spring常见注解

1.Autowired
通过spring的依赖注入功能来装配(注入)bean,这个注入动作是通过org.springframework.beans.factory.config.BeanPostProcessor来进行的,因此,BeanPostProcessor或者BeanFactoryPostProcessor中的引用不能通过Autowired来注入

2.疑问:Autowired与InjectParam的区别

3.Autowired与Resource的区别
   (1).Autowired是spring的注解,Resource是jdk的注解
   (2).Autowired默认按照类型来注入,可以使用Qualifier来指定主要注入的bean;Resource默认按照名称来注入,可以使用name和type来指定注入的bean,如果按照名称找不到bean的话,就会按照类型来注入bean
   (3).Autowired可以指定required为false,当没有注入时,不会报错;Resource注入时,如果找不到对应的bean,则会报错

4.Component为Repository/Service/Controller的并集






猜你喜欢

转载自yangjianzhouctgu.iteye.com/blog/2295168