测试类自动注入失败:@RunWith(SpringRunner.class)爆红详解

代码如下:

@RunWith(SpringRunner.class)
@SpringBootTest
public class ProjectFontControllerTest {
     

因为缺少依赖,添加此依赖问题,如果有冲突可切换版本:

   <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.12</version>
		<!--<scope>test</scope>-->
	</dependency>

你可能感兴趣的:(springboot,spring,boot)