From 0805799bd0e11fb9d34e29ef2d662acf8a41b5c7 Mon Sep 17 00:00:00 2001 From: youthlql <1826692270@qq.com> Date: Sat, 18 Dec 2021 17:08:37 +0800 Subject: [PATCH] =?UTF-8?q?Spring=E6=BA=90=E7=A0=81=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E7=AB=A0=E5=A2=9E=E5=8A=A0=E4=B8=A4=E5=BC=A0=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spring-sourcecode-v1/01.第1章-Spring源码纵览.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/spring-sourcecode-v1/01.第1章-Spring源码纵览.md b/docs/spring-sourcecode-v1/01.第1章-Spring源码纵览.md index 84b6581..348a5f4 100644 --- a/docs/spring-sourcecode-v1/01.第1章-Spring源码纵览.md +++ b/docs/spring-sourcecode-v1/01.第1章-Spring源码纵览.md @@ -334,6 +334,10 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto ### 注册BeanDefinition-1 +#### 流程图-BeanDefinition注册流程 + + + - 我们要看BeanDefinition是何时被放入到beanDefinitionMap,只需要在DefaultListableBeanFactory用到`beanDefinitionMap.put()`的地方打个断点。 - 我们在DefaultListableBeanFactory里搜索,发现了registerBeanDefinition(注册Bean定义信息)这个方法名很像我们要找的东西,再看里面的代码,果然有`beanDefinitionMap.put()`这串代码,我们试着在这里打个断点 - 然后启动下面的测试类 @@ -973,6 +977,10 @@ public interface Aware { #### 创建Person对象 +##### 流程图-Bean对象创建流程 + + + ##### Debug调用栈 为了知道Aware的原理,我们给上面的pos_1和pos_2位置打上断点,看下是怎么进来的 @@ -1165,7 +1173,7 @@ public class MainConfig { synchronized (this.singletonObjects) { // ... try { - // 通过getObject获取真正的对象,有点类似于FactoryBean(这个不懂的建议先了解下Spring基本欧诺个发), + // 通过getObject获取真正的对象,有点类似于FactoryBean(这个不懂的建议先了解下Spring基本用法), // ObjectFactory类注释有说明。 singletonObject = singletonFactory.getObject(); newSingleton = true;