在spring中使用junit4测试

1 @RunWith(SpringJUnit4ClassRunner.class)   // 使用junit4测试
2 @ContextConfiguration(locations={"classpath:applicationContext.xml"})  // 引入spring配置文件

使用上面两个注释之后需要测试的方法用 @Test 注解标识即可。

posted @ 2019-11-11 16:56  不要西红柿  阅读(386)  评论(0编辑  收藏  举报