If the <constructor-arg> attribute is ref , the parameter order is ignored in spring when constructing injection with XML configuration
<constructor-arg ref= "Killer"/>
<constructor-arg ref= "User"/>
And
<constructor-arg ref= "User"/>
<constructor-arg ref= "Killer"/>
The same effect (assuming that there is only one construction method, the parameter order is (Killer K, User us), these 2 kinds of notation are OK; Of course, if there is a second construction method, the parameter order is (User us, Killer K), then the second one will match the second construction method);
However, if the <constructor-arg> attribute has value , the parameter order must be considered
<constructor-arg value= "2"/>
<constructor-arg ref= "Killer"/>
And
<constructor-arg ref= "Killer"/>
<constructor-arg value= "2"/>
must correspond to 2 different construction methods respectively
The experience of constructing injection with XML configuration in spring