spring List,Set,Map,Properties,array的使用配置文件注入实例
来源:互联网 发布:奥卡福体测数据 编辑:程序博客网 时间:2024/05/22 15:48
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><beans> <bean id="chinese" class="Bean.collections.Chinese"> <!--List 注入例子--> <property name="schools"> <list> <value>小学</value> <value>中学</value> <value>大学</value> </list> </property> <!--Properties 注入例子--> <property name="health"> <props> <prop key="血压">正常</prop> <prop key="身高">178</prop> </props> </property> <!--Map 注入例子--> <property name="scores"> <map> <entry key="数学"> <value>88</value> </entry> <entry key="语文"> <value>99</value> </entry> </map> </property><!--Map 例子--> <bean id="accountConfig" class="java.util.HashMap"> <constructor-arg> <map> <entry key="accountResourceSQL"> <value>SELECT * FROM ABC</value> </entry> </map> </constructor-arg> </bean> <!-Set 注入例子--> <property name="axes"> <set> <value>字符串斧子</value> <!-- 用嵌套bean定义属性 --> <bean class="Bean.collections.WoodAxe"/> <!-- 引用bean作为属性 --> <ref local="steelaxe"/> </set> </property> <!--array 注入例子--> <property name="array"> <list> <value>array1</value> <value>array2</value> </list> </property> </bean> <bean id="steelaxe" class="Bean.collections.SteelAxe"></bean></beans>
实例java代码:
package Bean.collections;import java.util.ArrayList;import java.util.HashMap;import java.util.HashSet;import java.util.List;import java.util.Map;import java.util.Properties;import java.util.Set;import Bean.collections.Person;public class Chinese implements Person { private List schools=new ArrayList(); private Map scores=new HashMap(); private Properties health=new Properties(); private Set axes=new HashSet(); public Set getAxes() { return axes; } public void setAxes(Set axes) { this.axes = axes; } public Properties getHealth() { return health; } public void setHealth(Properties health) { this.health = health; } public List getSchools() { return schools; } public void setSchools(List schools) { this.schools = schools; } public Map getScores() { return scores; } public void setScores(Map scores) { this.scores = scores; } public void useAxe() { System.out.println(schools); System.out.println(scores); System.out.println(axes); System.out.println(health); }}
0 0
- spring List,Set,Map,Properties,array的使用配置文件注入实例
- Spring中注入List Set Map Properties的配置文件
- List,Set,Map,Properties的Spring注入实例
- List,Set,Map,Properties的Spring注入实例
- List,Set,Map,Properties的Spring注入实例
- spring注入Set,List,Properties和Map
- Spring 注入 List Set Properties Map
- Spring注入Properties、List、Map、Set
- (3) spring注入Properties,List,Set,Map
- Spring注入集合的值List,Set,Map,Properties
- Spring集合 (List,Set,Map,Properties) 实例
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Spring中使用Map、Set、List、数组、属性集合的注入方法配置文件
- Online Judge System For SzNOI 题库 语法百题 c++ d018
- hession开发遇到的问题 Server returned HTTP response code: 500 for URL:
- PHP 中运用 elasticsearch
- 在 python 使用socket 获取 IP
- STL map常用操作简介
- spring List,Set,Map,Properties,array的使用配置文件注入实例
- c#调用硬件提供的二次开发函数方法
- C++ primer读书笔记 4
- 2012年5月SAT香港真题解析
- 使用NTFS文件系统加密文件后,重装系统,文件打不开
- list_borrow_view.setEmptyView(empty_view); 当listview为空则显示这个
- 嵌套循坏逐步求数组最大值并打印
- 连接指定wifi,断开wifi解决方案
- 栈的顺序表示和实现