From f27304d785b47f5390230e7ccde028a37989d5ee Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sat, 1 Feb 2014 19:28:40 +0100 Subject: [PATCH] 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 --- .../support/GenericTypeAwareAutowireCandidateResolver.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/GenericTypeAwareAutowireCandidateResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/GenericTypeAwareAutowireCandidateResolver.java index 8b62873e1d..65554ce9b5 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/GenericTypeAwareAutowireCandidateResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/GenericTypeAwareAutowireCandidateResolver.java @@ -106,12 +106,10 @@ public class GenericTypeAwareAutowireCandidateResolver implements AutowireCandid } } } - if (targetType == null) { + if (targetType == null || (descriptor.fallbackMatchAllowed() && targetType.hasUnresolvableGenerics())) { return true; } - if (descriptor.fallbackMatchAllowed() && targetType.hasUnresolvableGenerics()) { - return descriptor.getDependencyType().isAssignableFrom(targetType.getRawClass()); - } + // Full check for complex generic type match... return dependencyType.isAssignableFrom(targetType); }