public class PersonServiceBean implements IPersonService {
public void init(){
System.out.println("我是初始化函數(shù)");
}
public PersonServiceBean(){
System.out.println("我是構(gòu)造函數(shù)");
}
public void Save(){
System.out.println("save方法");
}
public void cleanup(){
System.out.println("cleanup方法");
}
}
<bean id="personService"
class="cn.itcast.service.impl.PersonServiceBean"
init-method="init" destroy-method="cleanup"/>
@Test public void instanceSpring(){
ClassPathXmlApplicationContext ctx=new ClassPathXmlApplicationContext("beans.xml");
IPersonService ipersonService=(IPersonService)ctx.getBean("personService");
ctx.close();
只有注冊用戶登錄后才能發(fā)表評論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
|
||
相關(guān)文章:
|
||