Turn nested generic FactoryBean type into resolved Class for fallback match

See gh-29385
This commit is contained in:
Juergen Hoeller
2022-11-09 11:24:50 +01:00
parent 69736af5fc
commit 70bb785ed6
2 changed files with 47 additions and 20 deletions

View File

@@ -110,6 +110,11 @@ public class GenericTypeAwareAutowireCandidateResolver extends SimpleAutowireCan
Class<?> typeToBeMatched = dependencyType.resolve();
if (typeToBeMatched != null && !FactoryBean.class.isAssignableFrom(typeToBeMatched)) {
targetType = targetType.getGeneric();
if (descriptor.fallbackMatchAllowed()) {
// Matching the Class-based type determination for FactoryBean
// objects in the lazy-determination getType code path below.
targetType = ResolvableType.forClass(targetType.resolve());
}
}
}
}