SPR-7443 - Constructor arg resolution by name (doc)
Added documentation on constructor argument disambiguation by using the argument names.
This commit is contained in:
parent
b2b195e2cf
commit
e8b9c6d5ff
|
|
@ -158,6 +158,22 @@ public class ExampleBean {
|
|||
has two arguments of the same type. Note that the <emphasis>index is
|
||||
0 based</emphasis>.</para>
|
||||
</section>
|
||||
|
||||
<section id="beans-factory-ctor-arguments-name">
|
||||
<title>Constructor argument name</title>
|
||||
|
||||
<para>As of Spring 3.0 you can also use the constructor parameter
|
||||
name for value disambiguation:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="exampleBean" class="examples.ExampleBean">
|
||||
<constructor-arg name="years" value="7500000"/>
|
||||
<constructor-arg name="ultimateanswer" value="42"/>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>Keep in mind that your code has to be compiled with the debug
|
||||
flag enabled so that Spring can lookup the parameter name from the
|
||||
constructor.</para>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue