<!-- 依赖注入的装配过程 -->
<bean id="person" class="com.lee.spring007.di.xml.setter.Person">
<property name="pid" value="1001"></property>
<property name="name" value="nathan"></property>
<property name="stu" ref="student"></property>
<property name="list">
<list>
<value>a</value>
<value>b</value>
<value>c</value>
<value>d</value>
<value>e</value>
</list>
</property>
<property name="map">
<map>
<entry key="number" value="111"></entry>
<entry key="bean" value-ref="student"></entry>
</map>
</property>
<property name="properties">
<props>
<prop key="one">111</prop>
<prop key="two">222</prop>
<prop key="three">333</prop>
</props>
</property>
<property name="sets">
<set>
<value>11</value>
<ref bean="student" />
</set>
</property>
<property name="obj">
<list>
<value>a</value>
<value>b</value>
<value>c</value>
<value>d</value>
<value>e</value>
</list>
</property>
</bean>
<bean id="student" class="com.lee.spring007.di.xml.setter.Student"></bean>
package com.lee.spring007.di.xml.setter;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
public class Person {
private int pid;
private String name;
private Student stu;
private List list;
private Set sets;
private Map map;
private Properties properties;
private Object[] obj;
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Student getStu() {
return stu;
}
public void setStu(Student stu) {
this.stu = stu;
}
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public Map getMap() {
return map;
}
public void setMap(Map map) {
this.map = map;
}
public Properties getProperties() {
return properties;
}
public void setProperties(Properties properties) {
this.properties = properties;
}
public Object[] getObj() {
return obj;
}
public void setObj(Object[] obj) {
this.obj = obj;
}
public Set getSets() {
return sets;
}
public void setSets(Set sets) {
this.sets = sets;
}
}
package com.lee.spring007.di.xml.setter;
public class Student {
public static void say() {
System.out.println("I am a student!");
}
}