0

Currently, I'm setting additional spring boot properties file using spring.config.additional-location:

mvn -DskipTests spring-boot:run -Dspring-boot.run.arguments=--spring.config.additional-location=api-props.properties

I'd like to know how to set this additional properties file when I test it. Up to now, I've tested to put this parameter on test.

mvn test -Dspring-boot.run.arguments=--spring.config.additional-location=api-props.properties

Any ideas?

Jordi
  • 20,868
  • 39
  • 149
  • 333

1 Answers1

0

In general, there are many options. Start with application.properties in src/test/resources folder.

If the test is marked with @SpringBootTest this properties file will be picked automatically. It will also override properties specified in "usual" application properties

Another good option is using @TestPropertySources annotation

For complete list see here

Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97