springboot报错---@RunWith(SpringRunner.class)

    科技2025-07-16  14

    @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> <!--<scope>test</scope> --> </dependency>
    Processed: 0.009, SQL: 8