Avoid FactoryBean initialization on isSingleton check for decorated bean definition
Issue: SPR-14892 Issue: SPR-15042
This commit is contained in:
@@ -413,10 +413,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
!requiresEagerInitForType(mbd.getFactoryBeanName()))) {
|
||||
// In case of FactoryBean, match object created by FactoryBean.
|
||||
boolean isFactoryBean = isFactoryBean(beanName, mbd);
|
||||
boolean matchFound = (allowEagerInit || !isFactoryBean ||
|
||||
(mbd.getDecoratedDefinition() != null && !mbd.isLazyInit()) ||
|
||||
containsSingleton(beanName)) &&
|
||||
(includeNonSingletons || isSingleton(beanName)) &&
|
||||
BeanDefinitionHolder dbd = mbd.getDecoratedDefinition();
|
||||
boolean matchFound =
|
||||
(allowEagerInit || !isFactoryBean ||
|
||||
(dbd != null && !mbd.isLazyInit()) || containsSingleton(beanName)) &&
|
||||
(includeNonSingletons ||
|
||||
(dbd != null ? mbd.isSingleton() : isSingleton(beanName))) &&
|
||||
isTypeMatch(beanName, type);
|
||||
if (!matchFound && isFactoryBean) {
|
||||
// In case of FactoryBean, try to match FactoryBean instance itself next.
|
||||
|
||||
Reference in New Issue
Block a user