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

src/test/java packages and src/main/java packages should match. I had same issue where

  • my src/main/java packages were starting with com.comp.example but
  • src/test/java packages were starting with com.sample.example

Because of this spring boot application was not able to pickup the configuration of the application, which it picks up from @SpringBootApplication class. So test case should fall under the same packages where @SpringBootApplication in src/main/java is written.


When the Spring Boot starts, it scans the classpath from the top to the bottom of the project to find the config file. Your config is under another files and that is a reason of the problem. Move you config upper to the monolith package and everything gonna be fine.


@SpringBootTest has a parameter named classes. It accepts an array of classes for configuration. Add the class for the config file to it, for example:

@SpringBootTest(classes={com.lapots.game.monolith.web.GrandJourneyMonolithApplication.class})