构建源码阅读环境
安装gradle5.6.3
下载spring-framework-5.1.x
导入IDEA,效果如下
源码阅读
1. org.springframework.beans.factory.support.AbstractBeanFactory#doGetBean
(1) AbstractBeanFactory#transformedBeanName 进行别名转换处理,将别名转换为对应的BeanName
(2)org.springframework.beans.factory.support.DefaultSingletonBeanRegistry#getSingleton(java.lang.String)
1.1 singletonObjects.get(beanName);从缓存池中获取Bean
1.1.1 beforeSingletonCreation 创建单例前进行检查,避免重复创建