Spring boot Maven install error – Unable to find a @SpringBootConfiguration

Tags: , , ,

I’m trying to do clean and install on my Spring Boot project in before creating the Jar file for my project however I came across this error

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

I’m new to Spring Boot and have never really utilized the test function of it. So my test class is pretty much default of how it was initially created with the project.

My test class

   package com.Alex.demo;

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

class WebAppApplicationTests {

    void contextLoads() {


File directory

enter image description here


@RunWith(SpringRunner.class) works

Source: stackoverflow