lenientConstructorResolution flag applies to factory methods as well

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1638 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2009-07-27 14:09:42 +00:00
parent 903e432434
commit 1b37f79e4e
3 changed files with 35 additions and 1 deletions
@@ -443,6 +443,12 @@ class ConstructorResolver {
argsToUse = args.arguments;
minTypeDiffWeight = typeDiffWeight;
}
else if (typeDiffWeight < Integer.MAX_VALUE && typeDiffWeight == minTypeDiffWeight &&
!mbd.isLenientConstructorResolution()) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Ambiguous factory method matches found in bean '" + beanName + "' " +
"(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)");
}
}
}