SpringBoot自动创建后,test 中没有 @RunWith(SpringRunner.class)注解。
@SpringBootTest
class Chapter2ApplicationTests {
@Test
void contextLoads() {
}
}
解决方法:在pom.xml中添加 junit 依赖
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
该博客讨论了SpringBoot应用在创建后,test类中缺少@RunWith(SpringRunner.class)注解的问题。解决方案是在pom.xml文件中添加JUnit依赖,确保测试环境的正确配置。
1149

被折叠的 条评论
为什么被折叠?



