the difference between value and ref in Spring?
- From: rmn190 <rmn190@xxxxxxxxx>
- Date: Sun, 30 Dec 2007 20:36:17 -0800 (PST)
my before understanding of the that is:
by value,we mean that what we want inject is primitives or
String,while with ref,what we want to inject is self-difined objects.
but i find some different today when i reread the Spring
document(version is spring-framework-2.0.6),in the section of
"3.3.3.1.1. The idref element",there is an example to explain the
idref element,it is :
<bean id="theTargetBean" class="..."/> ---(1)
<bean id="client" class="...">
<property name="targetName">
<value>theTargetBean</value>
</property>
</bean>
</bean>
and
<bean id="theTargetBean" class="..."/> ---(2)
<bean id="client" class="...">
<property name="targetName">
<idref bean="theTargetBean" />
</property>
</bean>
</bean>,
and the docs says:
bean definition snippet (2) is exactly equivalent (at runtime) to
the snippet (1).
could you help with that?
.
- Prev by Date: Re: NullPointerException, IllegalArgumentException, or AssertionError for null constructor argument
- Next by Date: Re: Why is dynamic polymorphism so useful?
- Previous by thread: about idref and prototype in Spring?
- Next by thread: [COMMERCIAL] Help required - www.progforent.com
- Index(es):