|
|
|
@ -982,7 +982,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
String[] candidateNames = getBeanNamesForType(requiredType); |
|
|
|
String[] candidateNames = getBeanNamesForType(requiredType); |
|
|
|
|
|
|
|
|
|
|
|
if (candidateNames.length > 1) { |
|
|
|
if (candidateNames.length > 1) { |
|
|
|
ArrayList<String> autowireCandidates = new ArrayList<>(); |
|
|
|
List<String> autowireCandidates = new ArrayList<>(candidateNames.length); |
|
|
|
for (String beanName : candidateNames) { |
|
|
|
for (String beanName : candidateNames) { |
|
|
|
if (!containsBeanDefinition(beanName) || getBeanDefinition(beanName).isAutowireCandidate()) { |
|
|
|
if (!containsBeanDefinition(beanName) || getBeanDefinition(beanName).isAutowireCandidate()) { |
|
|
|
autowireCandidates.add(beanName); |
|
|
|
autowireCandidates.add(beanName); |
|
|
|
@ -999,12 +999,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
} |
|
|
|
} |
|
|
|
else if (candidateNames.length > 1) { |
|
|
|
else if (candidateNames.length > 1) { |
|
|
|
Map<String, Object> candidates = new LinkedHashMap<>(candidateNames.length); |
|
|
|
Map<String, Object> candidates = new LinkedHashMap<>(candidateNames.length); |
|
|
|
for (String candidateName : candidateNames) { |
|
|
|
for (String beanName : candidateNames) { |
|
|
|
if (containsSingleton(candidateName)) { |
|
|
|
if (containsSingleton(beanName)) { |
|
|
|
candidates.put(candidateName, getBean(candidateName, requiredType, args)); |
|
|
|
candidates.put(beanName, getBean(beanName, requiredType, args)); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
candidates.put(candidateName, getType(candidateName)); |
|
|
|
candidates.put(beanName, getType(beanName)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
String candidateName = determinePrimaryCandidate(candidates, requiredType); |
|
|
|
String candidateName = determinePrimaryCandidate(candidates, requiredType); |
|
|
|
@ -1688,7 +1688,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto |
|
|
|
if (beanDefinition == null) { |
|
|
|
if (beanDefinition == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
List<Object> sources = new ArrayList<>(); |
|
|
|
List<Object> sources = new ArrayList<>(2); |
|
|
|
Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); |
|
|
|
Method factoryMethod = beanDefinition.getResolvedFactoryMethod(); |
|
|
|
if (factoryMethod != null) { |
|
|
|
if (factoryMethod != null) { |
|
|
|
sources.add(factoryMethod); |
|
|
|
sources.add(factoryMethod); |
|
|
|
|