|
|
|
@ -1,3 +1,7 @@
|
|
|
|
|
作者: [Java4ye](https://github.com/Java4ye)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 概览
|
|
|
|
|
|
|
|
|
|
本文将讲解 Spring 的原理,看看一个 Bean 是怎么被创建出来的,中间经历过那几道工序加工,它的生命周期是怎样的,以及有哪些扩展点,后置处理器可以使用,让你对 Spring 多一些了解!
|
|
|
|
@ -10,7 +14,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213224509864](/images/spring/image-20211213224509864.png)
|
|
|
|
|
![image-20211213224509864](../../../images/spring/image-20211213224509864.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -38,7 +42,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213224920994](/images/spring/image-20211213224920994.png)
|
|
|
|
|
![image-20211213224920994](../../../images/spring/image-20211213224920994.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -54,7 +58,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213225044814](/images/spring/image-20211213225044814.png)
|
|
|
|
|
![image-20211213225044814](../../../images/spring/image-20211213225044814.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -98,7 +102,7 @@
|
|
|
|
|
|
|
|
|
|
那么,结合我们从原料中获取的重要属性之一的 beanClass ,我们可以画出这么一张图 👇
|
|
|
|
|
|
|
|
|
|
![image-20211213225124831](/images/spring/image-20211213225124831.png)
|
|
|
|
|
![image-20211213225124831](../../../images/spring/image-20211213225124831.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -114,7 +118,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20210904162844126](/images/spring/image-20210904162844126.png)
|
|
|
|
|
![image-20210904162844126](../../../images/spring/image-20210904162844126.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -132,7 +136,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20210904161436139](/images/spring/image-20210904161436139.png)
|
|
|
|
|
![image-20210904161436139](../../../images/spring/image-20210904161436139.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -200,7 +204,7 @@ FactoryBean ,它本身就是个 Bean,算是小工厂 ,归 BeanFactory 这
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20210904174616712](/images/spring/image-20210904174616712.png)
|
|
|
|
|
![image-20210904174616712](../../../images/spring/image-20210904174616712.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -232,7 +236,7 @@ beanName 就是正常对象
|
|
|
|
|
|
|
|
|
|
大致如下 👇
|
|
|
|
|
|
|
|
|
|
![image-20211213225330193](/images/spring/image-20211213225330193.png)
|
|
|
|
|
![image-20211213225330193](../../../images/spring/image-20211213225330193.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -242,7 +246,7 @@ beanName 就是正常对象
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20210904161808341](/images/spring/image-20210904161808341.png)
|
|
|
|
|
![image-20210904161808341](../../../images/spring/image-20210904161808341.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -293,7 +297,7 @@ beanName 就是正常对象
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213225748030](/images/spring/image-20211213225748030.png)
|
|
|
|
|
![image-20211213225748030](../../../images/spring/image-20211213225748030.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -341,7 +345,7 @@ BeanFactoryPostProcessor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20210902072224002](/images/spring/image-20210902072224002.png)
|
|
|
|
|
![image-20210902072224002](../../../images/spring/image-20210902072224002.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -349,7 +353,7 @@ BeanFactoryPostProcessor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213225831583](/images/spring/image-20211213225831583.png)
|
|
|
|
|
![image-20211213225831583](../../../images/spring/image-20211213225831583.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -376,7 +380,7 @@ ps: 别看快搞错了 哈哈😝
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213225953964](/images/spring/image-20211213225953964.png)
|
|
|
|
|
![image-20211213225953964](../../../images/spring/image-20211213225953964.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -392,7 +396,7 @@ ps: 别看快搞错了 哈哈😝
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213230042502](/images/spring/image-20211213230042502.png)
|
|
|
|
|
![image-20211213230042502](../../../images/spring/image-20211213230042502.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -400,7 +404,7 @@ ps: 别看快搞错了 哈哈😝
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20210903080803199](/images/spring/image-20210903080803199.png)
|
|
|
|
|
![image-20210903080803199](../../../images/spring/image-20210903080803199.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -422,7 +426,7 @@ ps: 别看快搞错了 哈哈😝
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
![image-20211213230212297](/images/spring/image-20211213230212297.png)
|
|
|
|
|
![image-20211213230212297](../../../images/spring/image-20211213230212297.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|