File tree 1 file changed +16
-0
lines changed
spring-framework-reference/src
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,22 @@ public class ExampleBean {
158
158
has two arguments of the same type. Note that the <emphasis >index is
159
159
0 based</emphasis >.</para >
160
160
</section >
161
+
162
+ <section id =" beans-factory-ctor-arguments-name" >
163
+ <title >Constructor argument name</title >
164
+
165
+ <para >As of Spring 3.0 you can also use the constructor parameter
166
+ name for value disambiguation:</para >
167
+
168
+ <programlisting language =" xml" >< bean id="exampleBean" class="examples.ExampleBean">
169
+ < constructor-arg name="years" value="7500000"/>
170
+ < constructor-arg name="ultimateanswer" value="42"/>
171
+ < /bean> </programlisting >
172
+
173
+ <para >Keep in mind that your code has to be compiled with the debug
174
+ flag enabled so that Spring can lookup the parameter name from the
175
+ constructor.</para >
176
+ </section >
161
177
</section >
162
178
</section >
163
179
You can’t perform that action at this time.
0 commit comments