Skip to content

Commit f27304d

Browse files
committed
Avoid repeated assignability check for raw class on fallback match, since AutowireCandidateResolver is only being called for basic type matches to begin with
Issue: SPR-9965
1 parent 874a2a9 commit f27304d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/GenericTypeAwareAutowireCandidateResolver.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ protected boolean checkGenericTypeMatch(BeanDefinitionHolder bdHolder, Dependenc
106106
}
107107
}
108108
}
109-
if (targetType == null) {
109+
if (targetType == null || (descriptor.fallbackMatchAllowed() && targetType.hasUnresolvableGenerics())) {
110110
return true;
111111
}
112-
if (descriptor.fallbackMatchAllowed() && targetType.hasUnresolvableGenerics()) {
113-
return descriptor.getDependencyType().isAssignableFrom(targetType.getRawClass());
114-
}
112+
// Full check for complex generic type match...
115113
return dependencyType.isAssignableFrom(targetType);
116114
}
117115

0 commit comments

Comments
 (0)