public interface IPersonService {
public abstract void Save();
}
public class PersonDaoBean implements IPersonDao {
public void add(){
System.out.println("這是personDaoBean的Add()方法");
}
}
public class PersonServiceBean implements IPersonService {
private IPersonDao iPersonDao;
public IPersonDao getIPersonDao() {
return iPersonDao;
}
public void setIPersonDao(IPersonDao personDao) {
iPersonDao = personDao;
}
public void Save(){
iPersonDao.add();
}
}
public void instanceSpring() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
"beans.xml");
IPersonService ipersonService = (IPersonService) ctx
.getBean("personService");
ipersonService.Save();
ctx.close();
// ctx.registerShutdownHook();
}
只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問(wèn)
管理
|
||
相關(guān)文章:
|
||