标签:依赖 dog 递归调用 eth load state anti get 创建
一次典型的Spring依赖注入的调用栈:
singletonObjects
中查找;如果没有查找到,又是正在创建的bean,则从earlySingletonObjects
中查找;仍未查找到,则通过singletonFactories
取得。prototypesCurrentlyInCreation
[threadLocal
]中存在),则抛出异常,因为此时,很有可能已经发生了循环依赖。abstract
singletonObjects
上锁singletonsCurrentlyInCreation
中singletonsCurrentlyInCreation
中移除beanNamesingletonObjects
锁定singletonObjects
、registeredSingletons
,并从singletonFactories
、earlySingletonObjects
中移除singletonObjects
、registeredSingletons
、singletonFactories
、earlySingletonObjects
中移除FactoryBean
prototypesCurrentlyInCreation
中加入beanNameprototypesCurrentlyInCreation
中移除beanNameFactoryBean
FactoryBean
InstantiationAwareBeanPostProcessor
的postProcessBeforeInstantiation
,这里有可能会返回一个bean的代理。如果返回了bean的代理,那么它将直接执行beanProcessor的postProcessAfterInitialization方法,并返回。factoryBeanInstanceCache
中移除同名beanMergedBeanDefinitionPostProcessor
的postProcessMergedBeanDefinition
singletonFactories
与registeredSingletons
中,并从earlySingletonObjects
中将同名bean移除invokeAwareMethods
如果bean实现了Aware的一些子接口,如BeanNameAware,则将相应的属性set到bean中invokeInitMethods
InitializingBean
接口,执行afterPropertiesSet()回调InstantiationAwareBeanPostProcessor
的postProcessAfterInstantiation
方法autowireByName
或autowireByType
InstantiationAwareBeanPostProcessor
的postProcessPropertyValues
方法InstantiationAwareBeanPostProcessor
】postProcessBeforeInstantiation()
MergedBeanDefinitionPostProcessor
】postProcessMergedBeanDefinition()
InstantiationAwareBeanPostProcessor
】postProcessAfterInstantiation()
InstantiationAwareBeanPostProcessor
】postProcessPropertyValues()
BeanPostProcessor
】postProcessPropertyValues()
InstantiationAwareBeanPostProcessor
】postProcessBeforeInitialization()
InstantiationAwareBeanPostProcessor
】postProcessAfterInitialization()
标签:依赖 dog 递归调用 eth load state anti get 创建
原文地址:https://www.cnblogs.com/haoyoung/p/8986526.html