标签:
<bean id="date" class="java.util.Date"></bean>
<bean id="test" class="test.Test">
<!--注入list-->
<property name="list">
<list>
<value>1</value>
<value>2</value>
<ref bean="date"/>
</list>
</property>
<!--注入map-->
<property name="map">
<map>
<entry>
<key><value>1</value></key>
<value>mike</value>
</entry>
<entry>
<key><value>2</value></key>
<ref bean="date"/>
</entry>
</map>
</property>
<!--注入property-->
<property name="pro">
<props>
<prop key="p1">p11</prop>
<prop key="p2">p22</prop>
</props>
</property>
<!--注入set-->
<property name="set">
<set>
<value>set1</value>
<value>set2</value>
<ref bean="date"/>
</set>
</property>
</bean>
输出结果
set~[set1, set2, Sun Aug 02 17:20:03 CST 2015]~;map{1=mike, 2=Sun Aug 02 17:20:03 CST 2015}~;list[1, 2, Sun Aug 02 17:20:03 CST 2015]~;pro{p2=p22, p1=p11}
标签:
原文地址:http://www.cnblogs.com/JavaTWW/p/4696292.html