spring循环依赖
2022-07-27 22:02:56 19 举报
登录查看完整内容
spring总结
作者其他创作
大纲/内容
singletonsCurrentlyInCreation.remove(beanName)
AutowireCapableBeanFactory#resolveDependency
当前bean没注入内容的时候直接不执行后续流程
此时候选人BService会先被放入一级缓存之中,AService停留在二级缓存,继续走后续流程
不存在
doCreateBean
BServic
addSingletonFactory
@Lazy
earlySingletonObjects == null && allowEarlyReference
injectedElements > 0
no
singletonsCurrentlyInCreation.add(beanName)
AutowiredAnnotationBeanPostProcessor#postProcessProperties
存在
去三级 缓存中获取参数
AbstractAutowireCapableBeanFactory#populateBean
getSingleton被重载过多次,记得留意
创建候选人(BService)对象
getSingleton
createBean
AutowiredFieldElement#inject
未使用
针对依赖对象代理
singletonObjects == null && isSingletonCurrentlyInCreation
AServic
addSingleton
yes
ContextAnnotationAutowireCandidateResolver#getLazyResolutionProxyIfNecessary
DefaultListableBeanFactory#doResolveDependency
singletonFactories != null
使用
AbstractAutowireCapableBeanFactory#initializeBean
当第三次进来的时候,会将三级缓存中的信息剪切到二级缓存之中,然后 doCreateBean 执行完成
ContextAnnotationAutowireCandidateResolver#buildLazyResolutionProxy
End
DependencyDescriptor#resolveCandidate
doGetBean
收藏
0 条评论
回复 删除
下一页