Proper exception for non-matching argument on unique factory method

See gh-22420
This commit is contained in:
Juergen Hoeller
2019-03-13 14:04:17 +01:00
parent 88ca255c95
commit 4bee5073a0
2 changed files with 47 additions and 12 deletions

View File

@@ -562,7 +562,7 @@ class ConstructorResolver {
}
}
if (factoryMethodToUse == null) {
if (factoryMethodToUse == null || argsToUse == null) {
if (causes != null) {
UnsatisfiedDependencyException ex = causes.removeLast();
for (Exception cause : causes) {
@@ -615,7 +615,6 @@ class ConstructorResolver {
}
}
Assert.state(argsToUse != null, "Unresolved factory method arguments");
bw.setBeanInstance(instantiate(beanName, mbd, factoryBean, factoryMethodToUse, argsToUse));
return bw;
}