Manage build profiles/configs for Spring Boot application

315 Views Asked by At

I have written application using spring boot + scala with sbt and now I need to divide build configurations for dev and prod.

What has been done: created configs application.yml and application(-dev/prod).yml to start application locally, on dev and prod respectively.

What need to be done: find a way to configure spring boot profile (dev, prod) in javaopts or directly write corresponding config, also in javaopts.

I've tried to use these opts:

sbt service/run -Dspring.profiles.active=...
sbt service/run -Dspring.config.location=...
1

There are 1 best solutions below

0
On BEST ANSWER

The answer is to configure active profile like this:

sbt service/run --spring.profiles.active=...