Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration

The error happen in the class test, exemple in a test class generate by spring boot :

package com.example.demo;import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;@RunWith(SpringRunner.class)
@SpringBootTest
public class HelloApplicationTests {

@Test
public void contextLoads() {
}

}

replace the line @SpringBootTest

by

@SpringBootTest(classes = TheNameOfYourMainClassWebApplication.class)

exemple :

@SpringBootTest(classes = SpringBootWebApplication.class)

 

this action should solved your build failure.

Laisser un commentaire