Skip to content
Advertisement

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

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;


@SpringBootTest
class WebAppApplicationTests {

    @Test
    void contextLoads() {
    }

}

File directory

enter image description here

Advertisement

Answer

@RunWith(SpringRunner.class) works

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement