尝试用单元测试做spring注入调用service

尝试用单元测试做spring注入调用service


public class GoodsCategoryServiceImplTest extends TestCase{


    public ApplicationContext  context=null;
    
    protected void setUp() throws Exception {
    String[] files={"appContext-core.xml","appContext-memcached.xml","appContext-mvc.xml"};
    context=(ApplicationContext)new ClassPathXmlApplicationContext(files);
    
    }
public void test(){
GoodsCategoryService goodsCategoryService=(GoodsCategoryService) context.getBean("goodsCategoryService");
System.out.println(goodsCategoryService.getAll(new HashMap()).size());
}


}



      本文转自yjflinchong 51CTO博客,原文链接:http://blog.51cto.com/yjflinchong/1165011,如需转载请自行联系原作者


上一篇:如何使用WooCommerce简码


下一篇:阿里云发布混合云存储阵列,助力企业数字化转型