@ -724,19 +724,18 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@@ -724,19 +724,18 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
int minNrOfArgs =
( mbd . hasConstructorArgumentValues ( ) ? mbd . getConstructorArgumentValues ( ) . getArgumentCount ( ) : 0 ) ;
Method [ ] candidates = ReflectionUtils . getUniqueDeclaredMethods ( factoryClass ) ;
for ( Method factoryMethod : candidates ) {
if ( Modifier . isStatic ( factoryMethod . getModifiers ( ) ) = = isStatic & &
factoryMethod . getName ( ) . equals ( mbd . getFactoryMethodName ( ) ) & &
factoryMethod . getParameterCount ( ) > = minNrOfArgs ) {
for ( Method candidate : candidates ) {
if ( Modifier . isStatic ( candidate . getModifiers ( ) ) = = isStatic & & mbd . isFactoryMethod ( candidate ) & &
candidate . getParameterCount ( ) > = minNrOfArgs ) {
// Declared type variables to inspect?
if ( fa ctoryM ethod . getTypeParameters ( ) . length > 0 ) {
if ( candida te . getTypeParameters ( ) . length > 0 ) {
try {
// Fully resolve parameter names and argument values.
Class < ? > [ ] paramTypes = fa ctoryM ethod . getParameterTypes ( ) ;
Class < ? > [ ] paramTypes = candida te . getParameterTypes ( ) ;
String [ ] paramNames = null ;
ParameterNameDiscoverer pnd = getParameterNameDiscoverer ( ) ;
if ( pnd ! = null ) {
paramNames = pnd . getParameterNames ( fa ctoryM ethod ) ;
paramNames = pnd . getParameterNames ( candida te ) ;
}
ConstructorArgumentValues cav = mbd . getConstructorArgumentValues ( ) ;
Set < ConstructorArgumentValues . ValueHolder > usedValueHolders = new HashSet < > ( paramTypes . length ) ;
@ -753,9 +752,9 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@@ -753,9 +752,9 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
}
}
Class < ? > returnType = AutowireUtils . resolveReturnTypeForFactoryMethod (
fa ctoryM ethod , args , getBeanClassLoader ( ) ) ;
uniqueCandidate = ( commonType = = null & & returnType = = fa ctoryM ethod . getReturnType ( ) ?
fa ctoryM ethod : null ) ;
candida te , args , getBeanClassLoader ( ) ) ;
uniqueCandidate = ( commonType = = null & & returnType = = candida te . getReturnType ( ) ?
candida te : null ) ;
commonType = ClassUtils . determineCommonAncestor ( returnType , commonType ) ;
if ( commonType = = null ) {
// Ambiguous return types found: return null to indicate "not determinable".
@ -769,8 +768,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
@@ -769,8 +768,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
}
}
else {
uniqueCandidate = ( commonType = = null ? fa ctoryM ethod : null ) ;
commonType = ClassUtils . determineCommonAncestor ( fa ctoryM ethod . getReturnType ( ) , commonType ) ;
uniqueCandidate = ( commonType = = null ? candida te : null ) ;
commonType = ClassUtils . determineCommonAncestor ( candida te . getReturnType ( ) , commonType ) ;
if ( commonType = = null ) {
// Ambiguous return types found: return null to indicate "not determinable".
return null ;