Refined predictBeanType's typesToMatch check for FactoryBeans

GroovyScriptFactoryTests passes again now.

Issue: SPR-10304
This commit is contained in:
Juergen Hoeller 2013-03-01 15:51:45 +01:00 committed by unknown
parent 9929182e30
commit e0c7571a41
1 changed files with 4 additions and 5 deletions

View File

@ -582,11 +582,10 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
for (BeanPostProcessor bp : getBeanPostProcessors()) {
if (bp instanceof SmartInstantiationAwareBeanPostProcessor) {
SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp;
Class predictedType = ibp.predictBeanType(beanClass, beanName);
if (predictedType != null && (typesToMatch.length > 1 ||
(typesToMatch.length > 0 && !FactoryBean.class.equals(typesToMatch[0])) ||
FactoryBean.class.isAssignableFrom(predictedType))) {
return predictedType;
Class predicted = ibp.predictBeanType(beanClass, beanName);
if (predicted != null && (typesToMatch.length != 1 || !FactoryBean.class.equals(typesToMatch[0]) ||
FactoryBean.class.isAssignableFrom(predicted))) {
return predicted;
}
}
}