Spring Boot Maven 安装错误 - 无法找到 @SpringBootConfiguration

Fen*_*zox 6 java spring maven spring-boot

在为我的项目创建 Jar 文件之前,我试图在我的 Spring Boot 项目上进行清理和安装,但是我遇到了这个错误

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
Run Code Online (Sandbox Code Playgroud)

我是 Spring Boot 的新手,从未真正使用过它的测试功能。所以我的测试类几乎是项目最初创建的默认类。

我的测试班

   package com.Alex.demo;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;


@SpringBootTest
class WebAppApplicationTests {

    @Test
    void contextLoads() {
    }

}
Run Code Online (Sandbox Code Playgroud)

文件目录

在此处输入图片说明