实体类
package com.wyl.pojo;
import java.util.*;
public class Student {
private Address address;
private String name;
private String[] book;
private List hobbys; //爱好
private Mapcard;//卡片
private Set gams;//
private String wife;// 空
private Properties info;//配置类
@Override
public String toString() {
return "Student{" +
"address=" + address.toString() +
", name='" + name + ''' +
", book=" + Arrays.toString(book) +
", hobbys=" + hobbys +
", card=" + card +
", gams=" + gams +
", wife='" + wife + ''' +
", info=" + info +
'}';
}
public void setAddress(Address address) {
this.address = address;
}
public void setName(String name) {
this.name = name;
}
public void setBook(String[] book) {
this.book = book;
}
public void setHobbys(List hobbys) {
this.hobbys = hobbys;
}
public void setCard(Map card) {
this.card = card;
}
public void setGams(Set gams) {
this.gams = gams;
}
public void setWife(String wife) {
this.wife = wife;
}
public void setInfo(Properties info) {
this.info = info;
}
public Address getAddress() {
return address;
}
public String getName() {
return name;
}
public String[] getBook() {
return book;
}
public List getHobbys() {
return hobbys;
}
public Map getCard() {
return card;
}
public Set getGams() {
return gams;
}
public String getWife() {
return wife;
}
public Properties getInfo() {
return info;
}
}
package com.wyl.pojo;
public class Address {
private String address;
public void setAddress(String address) {
this.address = address;
}
public String getAddress() {
return address;
}
@Override
public String toString() {
return "Address{" +
"address='" + address + ''' +
'}';
}
}
配置文件
红龙梦 水浒传 三国演义 西游记
打游戏 看小说 聊天 睡觉 LOL 金铲子 CF 0001 男
测试
import com.wyl.pojo.Student;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MyTest {
public static void main(String[] args) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
Student student = (Student) context.getBean("student");
System.out.println(student.toString());
}
}



