在spring中使用junit4测试
1 @RunWith(SpringJUnit4ClassRunner.class) // 使用junit4测试 2 @ContextConfiguration(locations={"classpath:applicationContext.xml"}) // 引入spring配置文件
使用上面两个注释之后需要测试的方法用 @Test 注解标识即可。
欺骗自己最简单,欺骗自己最困难。
安慰自己最简单,安慰自己最困难。
1 @RunWith(SpringJUnit4ClassRunner.class) // 使用junit4测试 2 @ContextConfiguration(locations={"classpath:applicationContext.xml"}) // 引入spring配置文件
使用上面两个注释之后需要测试的方法用 @Test 注解标识即可。