0

We are using Spring Boot 2.3.4

We have some Unit tests where we would only need the application.properties to be loaded (with all it's profile management aso.). Is it possible to do that without starting the complete Spring Boot server?

EDIT:

I tried the @SpringBootTest annotation, but it always started the whole server, because I referenced the @SpringBootApplication class (or it was referenced automatically). Actually you don't need all the other annotation, like @ConfigurationProperties

All you need is @SpringBootApplication(classes = AClass.class), where AClass is any class that doesn't have a main method, like your test class for example.

Schorsch
  • 203
  • 1
  • 2
  • 9

1 Answers1

0

Annotate your test class with @SpringBootTest to load the context.

Umesh Sanwal
  • 681
  • 4
  • 13