标签:依赖 dog 递归调用 eth load state anti get 创建
一次典型的Spring依赖注入的调用栈:
singletonObjects中查找;如果没有查找到,又是正在创建的bean,则从earlySingletonObjects中查找;仍未查找到,则通过singletonFactories取得。prototypesCurrentlyInCreation[threadLocal]中存在),则抛出异常,因为此时,很有可能已经发生了循环依赖。abstractsingletonObjects上锁singletonsCurrentlyInCreation中singletonsCurrentlyInCreation中移除beanNamesingletonObjects锁定singletonObjects、registeredSingletons,并从singletonFactories、earlySingletonObjects中移除singletonObjects、registeredSingletons、singletonFactories、earlySingletonObjects中移除FactoryBeanprototypesCurrentlyInCreation中加入beanNameprototypesCurrentlyInCreation中移除beanNameFactoryBeanFactoryBeanInstantiationAwareBeanPostProcessor的postProcessBeforeInstantiation,这里有可能会返回一个bean的代理。如果返回了bean的代理,那么它将直接执行beanProcessor的postProcessAfterInitialization方法,并返回。factoryBeanInstanceCache中移除同名beanMergedBeanDefinitionPostProcessor的postProcessMergedBeanDefinitionsingletonFactories与registeredSingletons中,并从earlySingletonObjects中将同名bean移除invokeAwareMethods 如果bean实现了Aware的一些子接口,如BeanNameAware,则将相应的属性set到bean中invokeInitMethods
InitializingBean接口,执行afterPropertiesSet()回调InstantiationAwareBeanPostProcessor的postProcessAfterInstantiation方法autowireByName或autowireByTypeInstantiationAwareBeanPostProcessor的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