Person:
package com.ly.spring; import java.util.*; public class Person { private String[] strArr; private List<String> strList; private Map<String,String> strMap; private Set<String> strSet; private Properties prop; public void setStrArr(String[] strArr) { this.strArr = strArr; } public void setStrList(List<String> strList) { this.strList = strList; } public void setStrMap(Map<String, String> strMap) { this.strMap = strMap; } public void setStrSet(Set<String> strSet) { this.strSet = strSet; } public void setProp(Properties prop) { this.prop = prop; } public String[] getStrArr() { return strArr; } public List<String> getStrList() { return strList; } public Map<String, String> getStrMap() { return strMap; } public Set<String> getStrSet() { return strSet; } public Properties getProp() { return prop; } }
配置文件:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="person" class="com.ly.spring.Person"> <property name="strArr"> <array> <value>AAA</value> <value>BBB</value> <value>CCC</value> </array> </property> <property name="strList"> <list> <value>DDD</value> <value>EEE</value> <value>FFF</value> </list> </property> <property name="strSet"> <set> <value>GGG</value> <value>HHH</value> <value>III</value> </set> </property> <property name="strMap"> <map> <entry key="k1" value="JJJ"></entry> <entry key="k2" value="KKK"></entry> <entry key="k3" value="LLL"></entry> </map> </property> <property name="prop"> <props> <prop key="p1">MMM</prop> <prop key="p2">NNN</prop> <prop key="p3">OOO</prop> </props> </property> </bean> </beans>
原文地址:https://www.cnblogs.com/liuyang-520/p/12332443.html
时间: 2024-10-19 04:49:59