Revert "Allow to use @Named annotation without having to set the bean as @Primary"

This reverts commit ca0be6e192.
This commit is contained in:
Dave Syer
2017-05-21 08:56:00 +01:00
parent ca0be6e192
commit afcc7dc371

View File

@@ -110,14 +110,8 @@ public class SpringModule implements Module {
@Override
public Object get() {
if (this.result == null) {
String[] named = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, this.type);
List<String> names = new ArrayList<>(named.length);
for (String name : named) {
if (name.equals(this.name)) names.add(name);
}
if (names.size() == 1) {
String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, this.type);
if (names.length == 1) {
this.result = this.beanFactory.getBean(this.name, this.type);
}
else {