org.springframework.beans.factory.support.DefaultSingletonBeanRegistry#earlySingletonObjects
找了个项目跑了一遍,没看到里面写入东西过~ 0==modCount
和它有关吗?DefaultListableBeanFactory#getBeansOfType(Class<T>, boolean, boolean)
allowEagerInit whether to initialize lazy-init singletons and objects created by FactoryBeans (or by factory methods with a "factory-bean" reference) for the type check. Note that FactoryBeans need to be eagerly initialized to determine their type: So be aware that passing in "true" for this flag will initialize FactoryBeans and "factory-bean" references.
两者有关系吗?
不好意思,看错了!既然提到了也索性问下 allowEagerInit
这个拿来干嘛的?
1
skypyb 2019-11-20 19:03:27 +08:00
这玩意我没记错的话是解决循环依赖的。
你搞几个 Bean 互相依赖试试 |
2
lxk11153 OP see docs.spring.io
1. `Setter-based Dependency Injection` 和 `Annotation-based Container Configuration`(@Resource ...) ---- earlySingletonObjects 就是解决它俩的循环依赖的 2. `Constructor-based Dependency Injection` ---- 它的循环依赖得调整自己的代码 3. allowEagerInit ---- 不知道 |
3
lxk11153 OP allowEagerInit ? 还是不知道区别在哪
https://blog.csdn.net/zknxx/article/details/80822352 |
4
lxk11153 OP 2. `Constructor-based Dependency Injection`
---- 它的循环依赖得调整自己的代码 see: blog.csdn.net/Revivedsun/article/details/84642316 |