Experience of injecting constructs in xml configuration in spring

When using the constructor injection in the xml configuration in spring, if the <constructor-arg> attributes are all refs , the parameter order is ignored.

<constructor-arg ref="killer" />

<constructor-arg ref="user" />

and

 

<constructor-arg ref="user" />

<constructor-arg ref="killer" />

the same effect;

But if the <constructor-arg> attribute has a value , be sure to consider the parameter order

<constructor-arg value="2"/>  

<constructor-arg ref="killer" />

and

<constructor-arg ref="killer" />

<constructor-arg value="2"/>  
must correspond to 2 different constructors

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326957656&siteId=291194637