Polishing

(cherry picked from commit c926ec4)
This commit is contained in:
Juergen Hoeller
2016-08-17 17:40:26 +02:00
parent 264f5335a3
commit 22ca7ac927
9 changed files with 37 additions and 36 deletions

View File

@@ -616,10 +616,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@Override
public void registerResolvableDependency(Class<?> dependencyType, Object autowiredValue) {
Assert.notNull(dependencyType, "Type must not be null");
Assert.notNull(dependencyType, "Dependency type must not be null");
if (autowiredValue != null) {
Assert.isTrue((autowiredValue instanceof ObjectFactory || dependencyType.isInstance(autowiredValue)),
"Value [" + autowiredValue + "] does not implement specified type [" + dependencyType.getName() + "]");
if (!(autowiredValue instanceof ObjectFactory || dependencyType.isInstance(autowiredValue))) {
throw new IllegalArgumentException("Value [" + autowiredValue +
"] does not implement specified dependency type [" + dependencyType.getName() + "]");
}
this.resolvableDependencies.put(dependencyType, autowiredValue);
}
}
@@ -1545,7 +1547,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
sources.add(factoryMethod);
}
Class<?> targetType = beanDefinition.getTargetType();
if (targetType != null && !targetType.equals(obj.getClass())) {
if (targetType != null && targetType != obj.getClass()) {
sources.add(targetType);
}
return sources.toArray(new Object[sources.size()]);