尝试用单元测试做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());
}


}

相关文章:

  • 2022-01-15
  • 2022-12-23
  • 2021-08-25
  • 2021-07-22
  • 2021-12-28
  • 2021-06-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案