The error proof way to pass the id of another bean in the container to supply values to constructor using
or
element is to use the idref element.
For the following example
_____________________________________________________________________________________
<bean id="exampleBean" class="examples.ExampleBean">
<constructor-arg index="0" value="7500000"/><constructor-arg index="1" value="42"/></bean>
_____________________________________________________________________________________
The idref element can used as
_____________________________________________________________________________________
<bean id="theTargetBean" class="..."/>
<bean id="theClientBean" class="...">
<property name="targetName">
<idref bean="theTargetBean" />
</property>
</bean>
__________________________________________________________________________________________
No comments:
Post a Comment