Here is a little more verbose example, suppose you have two beans A and B:
<bean class="A" id="a" />
<bean class="B"/>
<constructor-arg>
<ref bean="a"/>
<idref bean="a"/>
</constructor-arg>
</bean>
In this case B would have a constructor that would look like this:
public B(A a, String string) {
string.equals("a"); //true
}
So with ref you can reference an object and with idref you just reference the name of the bean
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…