DefaultListableBeanFactory skips fallback match attempt for Collection/Map beans

Issue: SPR-13963
This commit is contained in:
Juergen Hoeller
2016-02-19 00:05:28 +01:00
parent 0adc4921ed
commit 1b53edfc5e
2 changed files with 32 additions and 14 deletions

View File

@@ -1199,7 +1199,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
result.put(candidateName, getBean(candidateName));
}
}
if (result.isEmpty()) {
if (result.isEmpty() && !Collection.class.isAssignableFrom(requiredType) && !Map.class.isAssignableFrom(requiredType)) {
// Consider fallback matches if the first pass failed to find anything...
DependencyDescriptor fallbackDescriptor = descriptor.forFallbackMatch();
for (String candidateName : candidateNames) {