![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring
vicoqi
这个作者很懒,什么都没留下…
展开
-
Spring 循环依赖 - 揭开源码原来没那么神秘
Spring 循环依赖源码解析 前言 自己也经常看Spring源码,但是当初看的时候没有太过关注Spring 对于循环依赖这部分的解决方法,偶然看到网上几篇讲解的Spring 怎么解决循环依赖的解释,感觉自己还是没看太懂,所以自己动手探索下Spring 怎么解决的。 问题 首先我们需要知道什么叫做循环依赖,它是怎么产生的? 其实产生的原因是怪我们太懒了,靠Spring做了很多事情,包括对象的创建,对象的注入(IOC,DI),以至于帮我们注入的时候,发现实例A需要引用对象B的实例,但是实例B里又引用对象A的实原创 2020-07-20 15:34:34 · 526 阅读 · 3 评论 -
spring-ioc
实例化bean的三种方式:<!-- 默认的 把类添加到spring容器中 --> <bean id="helloWorld" class="com.example.vic.test_spring.ioc_di_setter_HelloWorld.HelloWorld"> <!-- 静态工厂 工厂方法是静态的原创 2016-06-20 16:51:28 · 203 阅读 · 0 评论 -
依赖注入setter,constructor
依赖注入setter这是两个要实例的类,要往person中注入多种属性,并配置applicationContext.xmlpublic class Student { public Student() { System.out.println("new Student"); } public void say() { System.out.pri原创 2016-06-20 17:03:27 · 341 阅读 · 0 评论 -
注解注入annotation
注解注入annotation 注意重点内容 要想用annotation必须在applicationContext.xml中加入 命名空间<!-- 要想用注解注入 ,必须加入这三条 xmlns:context="http://www.springframework.org/schema/context" http://www.springframework.org/schema/原创 2016-06-20 17:12:59 · 350 阅读 · 0 评论