Spring集合类型数据的注入


<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/util
            http://www.springframework.org/schema/util/spring-util-2.5.xsd">

    
    <bean id="Admin" class="com.zmj.web.po.Admin">
        <property name="list">
            <bean class="org.springframework.beans.factory.config.ListFactoryBean">
                <property name="targetListClass">
                    <value>java.util.ArrayListvalue>
                property>
                <property name="sourceList">
                    <list>
                        <value>001value>
                        <value>zhouvalue>
                        <value>value>
                    list>
                property>
            bean>
        property>
    bean>
    
    <bean id="Admin" class="com.zmj.web.po.Admin">
        <property name="list">
            <util:list list-class="java.util.ArrayList">
                <value>001value>
                <value>zhouvalue>
                <value>value>
            util:list>
        property>
    bean>

    
    <bean id="Admin" class="com.zmj.web.po.Admin">
        <property name="set">
            <set>
                <value>1value>
                <value>zhouvalue>
                <value>value>
            set>
        property>
    bean>

    
    <bean id="Admin" class="com.zmj.web.po.Admin">
        <property name="set">
            <util:set>
                <value>001value>
                <value>zhouvalue>
                <value>value>
            util:set>
        property>
    bean>
beans>

你可能感兴趣的:(web框架)