Bootstrap

Spring中@Autowired注解装配流程

众所周知,Autowired注解是通过AutowiredAnnotationBeanPostProcessor来解析的

第一个问题

注册AutowiredAnnotationBeanPostProcessor

AutowiredAnnotationBeanPostProcessor在哪里注册的?

过程比较复杂,在使用xml和注解不同的场景中,略有不同,具体可以参考如下文章:

xml开发方式下AutowiredAnnotationBeanPostProcessor的注册时机https://blog.csdn.net/leisure_life/article/details/125570942?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22125570942%22%2C%22source%22%3A%22leisure_life%22%7D&ctrtid=u1pD4

注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机https://blog.csdn.net/leisure_life/article/details/125572151?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22125572151%22%2C%22source%22%3A%22leisure_life%22%7D&ctrtid=ifvaE

只是注册了,只是在beanDefinitionMap中有了org.springframework.context.annotation.internalAutowiredAnnotationProcessor元素而已,还没创建成AutowiredAnnotationBeanPostProcessor对象

;