Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 270
Fenzox Avatar asked Jul 09 '20 15:07

Fenzox


1 Answers

@RunWith(SpringRunner.class) works

like image 106
sim zhihua Avatar answered Sep 22 '22 10:09

sim zhihua