-
Notifications
You must be signed in to change notification settings - Fork 0
Spring IOC 循环依赖
akun edited this page Jul 18, 2019
·
1 revision
spring ioc只能处理singleton类型bean的循环依赖,无法处理prototype以及构造器循环依赖
/** Cache of singleton objects: bean name to bean instance. */
private final Map<String, Object> singletonObjects = new ConcurrentHashMap<>(256);
/** Cache of singleton factories: bean name to ObjectFactory. */
private final Map<String, ObjectFactory<?>> singletonFactories = new HashMap<>(16);
/** Cache of early singleton objects: bean name to bean instance. */
private final Map<String, Object> earlySingletonObjects = new HashMap<>(16);
-
singletonObjects
一级缓存
-
singletonFactories
二级缓存
-
earlySingletonObjects
三级缓存