Polishing
This commit is contained in:
parent
765d43b34f
commit
7ac665b18e
|
@ -823,9 +823,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
* it will be fully created to check the type of its exposed object.
|
* it will be fully created to check the type of its exposed object.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected ResolvableType getTypeForFactoryBean(String beanName,
|
protected ResolvableType getTypeForFactoryBean(String beanName, RootBeanDefinition mbd, boolean allowInit) {
|
||||||
RootBeanDefinition mbd, boolean allowInit) {
|
|
||||||
|
|
||||||
// Check if the bean definition itself has defined the type with an attribute
|
// Check if the bean definition itself has defined the type with an attribute
|
||||||
ResolvableType result = getTypeForFactoryBeanFromAttributes(mbd);
|
ResolvableType result = getTypeForFactoryBeanFromAttributes(mbd);
|
||||||
if (result != ResolvableType.NONE) {
|
if (result != ResolvableType.NONE) {
|
||||||
|
@ -858,14 +856,14 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
// Try to obtain the FactoryBean's object type from its factory method
|
// Try to obtain the FactoryBean's object type from its factory method
|
||||||
// declaration without instantiating the containing bean at all.
|
// declaration without instantiating the containing bean at all.
|
||||||
BeanDefinition factoryBeanDefinition = getBeanDefinition(factoryBeanName);
|
BeanDefinition factoryBeanDefinition = getBeanDefinition(factoryBeanName);
|
||||||
Class<?> factoryBeanClass = null;
|
Class<?> factoryBeanClass;
|
||||||
if (factoryBeanDefinition instanceof AbstractBeanDefinition
|
if (factoryBeanDefinition instanceof AbstractBeanDefinition &&
|
||||||
&& ((AbstractBeanDefinition) factoryBeanDefinition).hasBeanClass()) {
|
((AbstractBeanDefinition) factoryBeanDefinition).hasBeanClass()) {
|
||||||
factoryBeanClass = ((AbstractBeanDefinition) factoryBeanDefinition).getBeanClass();
|
factoryBeanClass = ((AbstractBeanDefinition) factoryBeanDefinition).getBeanClass();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RootBeanDefinition fbmbd = getMergedBeanDefinition(factoryBeanName, factoryBeanDefinition);
|
RootBeanDefinition fbmbd = getMergedBeanDefinition(factoryBeanName, factoryBeanDefinition);
|
||||||
factoryBeanClass = determineTargetType(factoryBeanName, fbmbd, new Class<?>[] { Object.class });
|
factoryBeanClass = determineTargetType(factoryBeanName, fbmbd);
|
||||||
}
|
}
|
||||||
if (factoryBeanClass != null) {
|
if (factoryBeanClass != null) {
|
||||||
result = getTypeForFactoryBeanFromMethod(factoryBeanClass, factoryMethodName);
|
result = getTypeForFactoryBeanFromMethod(factoryBeanClass, factoryMethodName);
|
||||||
|
|
Loading…
Reference in New Issue