Leniently allow constructor argument matches if required name is not resolvable

Issue: SPR-13987
This commit is contained in:
Juergen Hoeller
2016-03-18 18:51:33 +01:00
parent 455bf45fa4
commit 431ca9314a
4 changed files with 14 additions and 8 deletions

View File

@@ -1612,12 +1612,14 @@ public class XmlBeanFactoryTests {
assertEquals(0, ((String[]) bean.array).length);
}
@Test @Ignore // TODO: SPR-13987
@Test
public void testConstructorWithUnresolvableParameterName() {
DefaultListableBeanFactory xbf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
AtomicInteger bean = (AtomicInteger) xbf.getBean("constructorUnresolvableName");
assertEquals(1, bean.get());
bean = (AtomicInteger) xbf.getBean("constructorUnresolvableNameWithIndex");
assertEquals(1, bean.get());
}
@Test

View File

@@ -231,4 +231,8 @@
<constructor-arg name="initialValue" value="1"/>
</bean>
<bean id="constructorUnresolvableNameWithIndex" class="java.util.concurrent.atomic.AtomicInteger" scope="prototype">
<constructor-arg index="0" name="initialValue" value="1"/>
</bean>
</beans>