______________________________________________________________________________________
public class ExampleBean {
private AnotherBean beanOne;
private YetAnotherBean beanTwo;
private int i;
public ExampleBean(
AnotherBean anotherBean, YetAnotherBean yetAnotherBean, int i) {
this.beanOne = anotherBean;
this.beanTwo = yetAnotherBean;
this.i = i;
}
}
_____________________________________________________________________________________
<bean id="exampleBean" class="examples.ExampleBean">
<!-- constructor injection using the nested <ref/> element -->
<constructor-arg><ref bean="anotherExampleBean"/>
</constructor-arg><!-- constructor injection using the neater 'ref' attribute -->
<constructor-arg ref="yetAnotherBean"/><constructor-arg type="int" value="1"/></bean>
<bean id="anotherExampleBean" class="examples.AnotherBean"/>
<bean id="yetAnotherBean" class="examples.YetAnotherBean"/>
____________________________________________________________________________________
No comments:
Post a Comment