import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import cn.baidu.java.SayHelloService;
public class Testmess {
private static ClassPathXmlApplicationContext caa;
public static void main(String[] args) {
caa=new ClassPathXmlApplicationContext("mven.xml");
SayHelloService says=caa.getBean("sayHelloServiceImpl",SayHelloService.class);
//执行业务
says.sayHelloService("88");
// 释放资源
}
public void destory(){
caa.close();
}
/*
private ClassPathXmlApplicationContext ct;
//**初始化spring容器*//*
@Before
public void init(){
ct=new ClassPathXmlApplicationContext("mven.xml");
}
// 测试具体业务应该
@Test
public void testsayHello(){
//1.获取对象
SayHelloService hser=ct.getBean("sayHelloServiceImpl",SayHelloService.class);
// 执行业务
hser.sayHelloService("000");
}
// 释放资源
@After
public void destory(){
ct.close();
}
*/
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。