spring源码分析五 bean的加载第二步

从parentBeanFactory中获取,并且处理循环依赖的问题:
org.springframework.beans.factory.support.AbstractBeanFactory.java中
doGetBean方法,

@SuppressWarnings("unchecked")
protected <T> T doGetBean(final String name, @Nullable final Class<T> requiredType,
		@Nullable final Object[] args, boolean typeCheckOnly) throws BeansException

部分代码块如下:
《spring源码分析五 bean的加载第二步》

接下来看 registerDependentBean的代码:在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.java中:
源码分析如下:
《spring源码分析五 bean的加载第二步》

接着往下分析代码:
《spring源码分析五 bean的加载第二步》

这里分三种情况来创建实例,分别是单例,原型,和其他scope的创建,我们将在下一篇博客中详细介绍单例的创建,其他的就略去了。
《spring源码分析五 bean的加载第二步》

    原文作者:Spring Boot
    原文地址: https://blog.csdn.net/guo20082200/article/details/83718686
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞