SpringBoot无法引入@RunWith注解解决方法
1.首先检查是否添加好了Test的Starter依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2.如果有上面的依赖依然无法运行,检查是否引入junit的依赖,加上如下依赖:
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.3</version>
<scope>test</scope>
</dependency>
3.针对不同版本的idea或eclipse,依赖的版本号可能找不到,可以自行去Maven仓库的官网去寻找适配的版本号,
地址:Maven仓库官网地址