zoukankan      html  css  js  c++  java
  • Spring 注入集合

    Spring 中,注入集合类型的数值方式

        <bean id="javaCollection" class="com.qie_zi.JavaCollection">
            <property name="addressList">
                <list>
                    <value>1</value>
                    <value>2</value>
                    <value>3</value>
                    <value>4</value>
                </list>
            </property>
            
            <property name="addressMap">
                <map>
                    <entry key="1" value="1"></entry>        
                    <entry key="2" value="2"></entry>        
                    <entry key="3" value="3"></entry>        
                    <entry key="4" value="4"></entry>        
                </map>
            </property>
            
            <property name="addressSet">
                <set>
                    <value>1</value>
                    <value>2</value>
                    <value>3</value>
                    <value>4</value>
                </set>
            </property>
            
            <property name="addressProp">
                <props>
                    <prop key="1">1</prop>
                    <prop key="1">2</prop>
                    <prop key="1">3</prop>
                    <prop key="1">4</prop>
                </props>
            </property>
        </bean>

    list  

            <property name="addressList">
                <list>
                    <value>1</value>
                    <value>2</value>
                    <value>3</value>
                    <value>4</value>
                </list>
            </property>

    map

            <property name="addressMap">
                <map>
                    <entry key="1" value="1"></entry>        
                    <entry key="2" value="2"></entry>        
                    <entry key="3" value="3"></entry>        
                    <entry key="4" value="4"></entry>        
                </map>
            </property>

    set

            <property name="addressSet">
                <set>
                    <value>1</value>
                    <value>2</value>
                    <value>3</value>
                    <value>4</value>
                </set>
            </property>

    Properties

            <property name="addressProp">
                <props>
                    <prop key="1">1</prop>
                    <prop key="1">2</prop>
                    <prop key="1">3</prop>
                    <prop key="1">4</prop>
                </props>
            </property>

     附录:pojo

    package com.qie_zi;
    
    import java.util.List;
    import java.util.Map;
    import java.util.Properties;
    import java.util.Set;
    
    public class JavaCollection {
        Map addressMap;
        List addressList;
        Set addressSet;
        Properties addressProp;
    
        public Map getAddressMap() {
            return addressMap;
        }
    
        public void setAddressMap(Map addressMap) {
            this.addressMap = addressMap;
        }
    
        public List getAddressList() {
            return addressList;
        }
    
        public void setAddressList(List addressList) {
            this.addressList = addressList;
        }
    
        public Set getAddressSet() {
            return addressSet;
        }
    
        public void setAddressSet(Set addressSet) {
            this.addressSet = addressSet;
        }
    
        public Properties getAddressProp() {
            return addressProp;
        }
    
        public void setAddressProp(Properties addressProp) {
            this.addressProp = addressProp;
        }
    
    }
  • 相关阅读:
    WP7 可以在XAML中使用的 缓存图片控件(适合静态)
    wp7蛋疼的90M内存限制,优化图片使用内存(4)[解决]
    Caliburn.Micro for wp7 学习笔记(2) : 响应 Butto事件
    Caliburn.Micro for wp7 学习笔记(3) : 响应 Butto事件原理
    Caliburn.Micro for wp7 学习笔记(1) : 建立 Caliburn.Micro 框架的 wp7 项目
    anthem.net 简单学习
    新公司研发能力低下,何去何从?
    C/C++指针和取地址操作
    利用bochs 调试(转)
    winform模式对话框和非模式对话框
  • 原文地址:https://www.cnblogs.com/qie-zi/p/8854268.html
Copyright © 2011-2022 走看看