Avoid eager instantiation of non-singleton FactoryBean in getBeanNamesForType
Closes gh-28616
This commit is contained in:
parent
e47cc44947
commit
0ce9516aef
|
|
@ -585,7 +585,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||||
if (!matchFound) {
|
if (!matchFound) {
|
||||||
// In case of FactoryBean, try to match FactoryBean instance itself next.
|
// In case of FactoryBean, try to match FactoryBean instance itself next.
|
||||||
beanName = FACTORY_BEAN_PREFIX + beanName;
|
beanName = FACTORY_BEAN_PREFIX + beanName;
|
||||||
matchFound = isTypeMatch(beanName, type, allowFactoryBeanInit);
|
matchFound = (includeNonSingletons || isSingleton(beanName, mbd, dbd)) && isTypeMatch(beanName, type, allowFactoryBeanInit);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (matchFound) {
|
if (matchFound) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue