Use non-lenient constructor resolution mode for @Bean methods

Since @Bean methods are never used with externally specified constructor argument values but rather just with autowiring, the non-lenient constructor resolution mode is appropriate in case of an overloaded @Bean method, not performing any type difference weight checks. This change includes a refinement of Spring's existing non-lenient constructor resolution (which needs to be explicitly turned on and is therefore not well tested), narrowing the conditions for the ambiguity check (only in case of the same number of arguments and not for overridden methods).

Issue: SPR-10988
This commit is contained in:
Juergen Hoeller
2013-11-04 00:19:55 +01:00
parent 49758a2a96
commit b093b84954
4 changed files with 34 additions and 23 deletions

View File

@@ -19,10 +19,10 @@ package org.springframework.context.annotation;
import java.lang.annotation.Inherited;
import java.util.List;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
@@ -74,7 +74,6 @@ public class BeanMethodPolymorphismTests {
}
@Test
@Ignore
public void beanMethodOverloadingWithInheritanceAndList() {
// SPR-11025
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubConfigWithList.class);