Skip to content

Multiple constructor-arg with same index=0 withing the same bean element does not throw exception [SPR-6329] #10995

Closed
@spring-projects-issues

Description

@spring-projects-issues

shine paul opened SPR-6329 and commented

I have a custom class MyClass

class MyClass {
String string = null;
int count = 0;
public Class(String string){
this.string = string;
}
public class MyString(String string, int count) {
this.string = string;
this.count = count;
}

In my applicationContext.xml
I have something like this

<bean id="MyClassClient" class="MyClass">
<constructor-arg index="0" value="testMe" />
<constructor-arg index="0" value=4 />
</bean>

I have typed the second index=0 by mistake (It should have been 1, so that spring could create the object with two arguments)
However Spring silently ignores my mistake and
creates an instance of MyClass which only takes String as the argument.

I would rather like Spring to complain about my mistake at this point.


Referenced from: commits 5d77255

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions