Junit整合:
jar包:
5个基本包,加一个测试包:
spring-framework-3.2.0.RELEASE\libs-->spring-test-3.2.0.RELEASE.jar
@RunWith(SpringJUnit4ClassRunner.class)将spring和junit进行整合
@ContextConfiguration(locations="classpath:applicationContext.xml")加载classpath下的配置文件。
上面两个加注在类上,下面一个加注在类内部
@Autowired 整合后将service层进行自动注入,这样就不需要再进行xml的扫描了。
private UserService userService;
spring--Junit整合
最新推荐文章于 2024-07-15 22:27:18 发布