@RunWith(SpringRunner.class)因为缺乏pom文件里Junit依赖导致。 解决方法: 在pom.xml里添加以下依赖
<dependency>
<groupId>org.springframework.boot
</groupId>
<artifactId>spring-boot-starter-test
</artifactId>
<scope>test
</scope>
</dependency>
<dependency>
<groupId>junit
</groupId>
<artifactId>junit
</artifactId>
<version>4.10
</version>
</dependency>
转载请注明原文地址:https://blackberry.8miu.com/read-39774.html