spring版本 5.2.1.RELEASE
问题描述:
A、B两个Bean 其中A通过autowire中注入了B,B通过autowire注入了A
解决流程:
关键代码:
refresh(AnnotationConfigApplicationContext)
finishBeanFactoryInitialization
beanFactory.preInstantiateSingletons
createBean(DefaultListableBeanFactory)
beanFactory.getBean
doCreateBean
boolean earlySingletonExposure
addSingletonFactory
populateBean
InstantiationAwareBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.postProcessProperties)
findAutowiringMetadata(this.injectionMetadataCache)
metadata.inject
inject(element.inject(AutowiredAnnotationBeanPostProcessor))
beanFactory.resolveDependency
doResolveDependency
descriptor.resolveCandidate
beanFactory.getBean