Only cache by-type lookups if configuration has been marked as frozen
Issue: SPR-9448
This commit is contained in:
parent
3c59725b94
commit
538ce4747d
|
|
@ -304,8 +304,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||||
if (type == null || !allowEagerInit) {
|
if (!isConfigurationFrozen() || type == null || !allowEagerInit) {
|
||||||
return this.doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
return doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||||
}
|
}
|
||||||
Map<Class<?>, String[]> cache = includeNonSingletons ?
|
Map<Class<?>, String[]> cache = includeNonSingletons ?
|
||||||
this.nonSingletonBeanNamesByType : this.singletonBeanNamesByType;
|
this.nonSingletonBeanNamesByType : this.singletonBeanNamesByType;
|
||||||
|
|
@ -313,7 +313,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||||
if (resolvedBeanNames != null) {
|
if (resolvedBeanNames != null) {
|
||||||
return resolvedBeanNames;
|
return resolvedBeanNames;
|
||||||
}
|
}
|
||||||
resolvedBeanNames = this.doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
resolvedBeanNames = doGetBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||||
cache.put(type, resolvedBeanNames);
|
cache.put(type, resolvedBeanNames);
|
||||||
return resolvedBeanNames;
|
return resolvedBeanNames;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue