getTypeForFactoryBean suppresses instantiation failures for non-singleton FactoryBeans

Issue: SPR-12786
This commit is contained in:
Juergen Hoeller
2015-03-06 11:52:27 +01:00
parent 0baf228db5
commit 9b25d6ad8b
2 changed files with 43 additions and 16 deletions

View File

@@ -897,6 +897,14 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
instance = bw.getWrappedInstance();
}
}
catch (BeanCreationException ex) {
// Can only happen when getting a FactoryBean.
if (logger.isDebugEnabled()) {
logger.debug("Bean creation exception on non-singleton FactoryBean type check: " + ex);
}
onSuppressedException(ex);
return null;
}
finally {
// Finished partial creation of this bean.
afterPrototypeCreation(beanName);