Properties:
<props>
<prop key="dbname">univiersitydb </prop>
<prop key="port">12345</prop>
<prop key="username">suresh</prop>
<prop key="password">suresh123</prop>
</props>
Ex:
<bean id="hank" class="com.springinaction.springidol.OneManBand">
<property name="instruments">
<props>
<prop key="GUITAR">STRUM STRUM STRUM</prop>
<prop key="CYMBAL">CRASH CRASH CRASH</prop>
<prop key="HARMONICA">HUM HUM HUM</prop>
</props>
</property>
</bean>
LIST
<bean id="hank" class="com.springinaction.springidol.OneManBand">
<property name="instruments">
<list>
<ref bean="guitar" />
<ref bean="cymbal" />
<ref bean="harmonica" />
</list>
</property>
</bean>
The <list> element contains one or more values. Here <ref> elements are used
to define the values as references to other beans in the Spring context. However, it’s also
possible to use other value-setting Spring elements as the members of a <list>, including
<value>, <bean>, and <null/>. In fact, a <list> may contain another <list> as a
member for multidimensional lists.
SET
<bean id="hank" class="com.springinaction.springidol.OneManBand">
<property name="instruments">
<set>
<ref bean="guitar" />
<ref bean="cymbal" />
<ref bean="harmonica" />
<ref bean="harmonica" />
</set>
</property>
</bean>
MAP
<bean id="hank" class="com.springinaction.springidol.OneManBand">
<property name="instruments">
<map>
<entry key="GUITAR" value-ref="guitar" />
<entry key="CYMBAL" value-ref="cymbal" />
<entry key="HARMONICA" value-ref="harmonica" />
</map>
</property>
</bean>
No comments:
Post a Comment