Spring Collections XML 配置

时间:2021-06-24 08:13:50
  • List
  • <property name="lists">
    <list>
    <value>1</value>
    <ref bean="PersonBean" />
    <bean class="com.mkyong.common.Person">
    <property name="name" value="mkyongList" />
    <property name="address" value="address" />
    <property name="age" value="28" />
    </bean>
    </list>
    </property>
  • Map
  • <property name="maps">
    <map>
    <entry key="Key 1" value="1" />
    <entry key="Key 2" value-ref="PersonBean" />
    <entry key="Key 3">
    <bean class="com.mkyong.common.Person">
    <property name="name" value="mkyongMap" />
    <property name="address" value="address" />
    <property name="age" value="28" />
    </bean>
    </entry>
    </map>
    </property>
  • Set
  • <property name="sets">
    <set>
    <value>1</value>
    <ref bean="PersonBean" />
    <bean class="com.mkyong.common.Person">
    <property name="name" value="mkyongSet" />
    <property name="address" value="address" />
    <property name="age" value="28" />
    </bean>
    </set>
    </property>
  • Properties
    <property name="propertyName" value="${property.name}"/>