maven 项目整合 spring junit 注解 及使用

在pom.xml中 添加坐标

在这里插入图片描述

在测试类上添加注解

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")

在这里插入图片描述

测试方法 只能是 公共的(public) 无返回值类型的 (void)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43726822/article/details/86481050