@@ -19,25 +19,25 @@ IOC,即控制反转(Inverse of Control)是一种**设计思想**,并不
1919
2020可这样表示:
2121
22- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_1.png " width =" 700px " /></div >
22+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_1.png " width =" 700px " /></div >
2323
2424相应代码代码:
2525
26- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_2.png " width =" 700px " /></div >
26+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_2.png " width =" 700px " /></div >
2727
2828size 是固定值,可以进行相应的改进:
2929
30- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_3.png " width =" 700px " /></div >
30+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_3.png " width =" 700px " /></div >
3131
3232** 依赖注入设计思路** :
3333
3434先设计行李箱的大概样子,再根据行李箱的样子设计箱体,根据箱体去设计底盘,然后去设计轮子。
3535
36- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_4.png " width =" 700px " /></div >
36+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_4.png " width =" 700px " /></div >
3737
3838相应代码如下:
3939
40- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_5.png " width =" 700px " /></div >
40+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_5.png " width =" 700px " /></div >
4141
4242不难理解,依赖注入就是** 将底层类作为参数传递给上层类,实现上层对下层的控制** 。
4343
@@ -145,7 +145,7 @@ public class ExampleBean {
145145
146146依赖倒置原则、IoC、DI 和 IoC 容器的关系:
147147
148- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_7.png " width =" 700px " /></div >
148+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_7.png " width =" 700px " /></div >
149149
150150补充:[ 控制反转-知乎解答] ( https://www.zhihu.com/question/23277575/answer/169698662 )
151151
@@ -173,15 +173,15 @@ Spring IoC 容器的代表就是 `org.springframework.beans` 包下的 **BeanFac
173173
174174### IoC 容器初始化过程
175175
176- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/01_1.png " width =" 700px " /></div >
176+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/01_1.png " width =" 700px " /></div >
177177
178178- Resource 定位:即 BeanDefinition 的资源定位,Resource 为各种形式的 BeanDefinition 的使用都提供了统一的接口
179179- BeanDefinition 的载入
180180- 向 IoC 容器中注册 BeanDefinition:实际上 IoC 容器内部维护一个 HashMap,注册过程就是将 BeanDefinition 添加至 HashMap 中。
181181
182182### Spring Bean 的装配流程
183183
184- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/ioc_11.png " width =" 700px " /></div >
184+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/ioc_11.png " width =" 700px " /></div >
185185
186186IoC 容器其实就是一个大工厂,它用来管理我们所有的对象以及依赖关系:
187187
@@ -325,7 +325,7 @@ globalSession 作用域**类似于标准的 HTTP session** 作用域, 不过
325325
326326Spring bean 的生命周期执行如下图:
327327
328- <div align =" center " ><img src =" https://gitee .com/duhouan /ImagePro/raw/master/java-notes/spring/spring_1.png " width =' 450px ' /></div >
328+ <div align =" center " ><img src =" https://github .com/DuHouAn /ImagePro/raw/master/java-notes/spring/spring_1.png " width =' 450px ' /></div >
329329
3303301、Spring 对 Bean 进行实例化。
331331
0 commit comments