Quote

We are what we repeatedly do. Excellence, therefore,is not an act but a habit.

Aristotle

Wednesday, January 6, 2010

THE idref ELEMENT - Spring Framework

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