Avoid stack overflow in case of chained factory-bean references to FactoryBean class

Issue: SPR-14551
This commit is contained in:
Juergen Hoeller
2016-08-11 22:56:14 +02:00
parent 6157fad91f
commit 8b5d3559f5
3 changed files with 23 additions and 11 deletions

View File

@@ -325,8 +325,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
}
@Override
public Object resolveDependency(DependencyDescriptor descriptor, String beanName) throws BeansException {
return resolveDependency(descriptor, beanName, null, null);
public Object resolveDependency(DependencyDescriptor descriptor, String requestingBeanName) throws BeansException {
return resolveDependency(descriptor, requestingBeanName, null, null);
}
@@ -802,10 +802,14 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
if (objectType.value != null) {
return objectType.value;
}
else {
// No type found for shortcut FactoryBean instance:
// fall back to full creation of the FactoryBean instance.
return super.getTypeForFactoryBean(beanName, mbd);
}
}
// No type found - fall back to full creation of the FactoryBean instance.
return super.getTypeForFactoryBean(beanName, mbd);
return null;
}
/**
@@ -824,7 +828,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor) bp;
exposedObject = ibp.getEarlyBeanReference(exposedObject, beanName);
if (exposedObject == null) {
return exposedObject;
return null;
}
}
}