user类里一个userName;一个Home对象的属性.
public class User {
private String userName;
private Home myHome;
public Home getMyHome() {
return myHome;
}
public void setMyHome(Home myHome) {
this.myHome = myHome;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
public class Home {
private String homeAddr;
public String getHomeAddr() {
return homeAddr;
}
public void setHomeAddr(String homeAddr) {
this.homeAddr = homeAddr;
}
} public class TestMain { public static void main(String[] args) {
ApplicationContext context=new FileSystemXmlApplicationContext("test/lyx/applicationContext.xml");
User user1=(User)context.getBean("user");