Skip to content

Commit

Permalink
Avoid eager instantiation of non-singleton FactoryBean in getBeanName…
Browse files Browse the repository at this point in the history
…sForType

Closes gh-28616
  • Loading branch information
fsgonz authored and sbrannen committed Jun 14, 2022
1 parent e47cc44 commit 0ce9516
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -585,7 +585,8 @@ private String[] doGetBeanNamesForType(ResolvableType type, boolean includeNonSi
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) {
Expand Down

0 comments on commit 0ce9516

Please sign in to comment.