Person类:
package cn.sdut.service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
public class Person {
private String name;
private int age;
private String[] arr;
private List<HelloService> list;
private Map<String, HelloService> map;
private Properties properties;
public Properties getProperties() {
return properties;
}
public void setProperties(Properties properties) {
this.properties = properties;
}
public Map<String, HelloService> getMap() {
return map;
}
public void setMap(Map<String, HelloService> map) {
this.map = map;
}
public List<HelloService> getList() {
return list;
}
public void setList(List<HelloService> list) {
this.list = list;
}
public String[] getArr() {
return arr;
}
public void setArr(String[] arr) {
this.arr = arr;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Person [name=" + name + ", age=" + age + ", arr="
+ Arrays.toString(arr) + ", list=" + list + ", map=" + map
+ ", properties=" + properties + "]";
}
}
applicationContext.xml部分
<!--bean装配 -->
<bean id="person" class="cn.sdut.service.Person">
<property name="name" value="邹邹" />
<property name="age" value="1"/>
<property name="arr">
<list>
<value>q</value>
<value>w</value>
<value>e</value>
</list>
</property>
<property name="list">
<list>
<ref bean="helloService"/>
</list>
</property>
<property name="map">
<map>
<entry key="1" value-ref="helloService"/>
<entry key="2" value-ref="helloService"/>
</map>
</property>
<property name="properties">
<props>
<prop key="driver">oracle.jdbc.driver.OracleDriver</prop>
<prop key="url">oracl:jdbc:thin:@localhost:1150:hp</prop>
</props>
</property>
</bean>