<!-- 依赖注入的装配过程 -->
<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!");
}
}
点击查看更多内容
风间影月说
去围观
创业公司技术总监, 10年+开发和技术管理经验。SUN认证SCJP、PMP、MCP认证。主要从事后端技术和架构领域,有丰富的电商平台与物流平台核心系统的架构设计和开发经验。
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦