Browse Source

Avoid eager instantiation of non-singleton FactoryBean in getBeanNamesForType

Closes gh-28616
pull/28652/head
Fabian Gonzalez 4 years ago committed by Sam Brannen
parent
commit
0ce9516aef
  1. 3
      spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

3
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

@ -585,7 +585,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -585,7 +585,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
if (!matchFound) {
// In case of FactoryBean, try to match FactoryBean instance itself next.
beanName = FACTORY_BEAN_PREFIX + beanName;
matchFound = isTypeMatch(beanName, type, allowFactoryBeanInit);
matchFound = (includeNonSingletons || isSingleton(beanName, mbd, dbd)) && isTypeMatch(beanName, type, allowFactoryBeanInit);
}
}
if (matchFound) {

Loading…
Cancel
Save