Reputation: 1891
I have created 2 files under src/main/resources:
The first one has properties that take values from env variables, while the latter has fixed values.
According to specific here, I've launched spring boot in such way:
mvn spring-boot:run -Dspring.profiles.active=local
However no effects are produced and application-local.properties seems to be ignored.
Any hints?
Upvotes: 4
Views: 2250
Reputation: 5852
Yeah, if you're running with the spring-boot plugin, you have to pass the profile with -Dspring-boot.run.profiles
, try
mvn spring-boot:run -Dspring-boot.run.profiles=local
Upvotes: 4
Reputation: 1310
In the same path as the existing application.properties file, you can create 2 environment files:
application-local.properties
application-server.properties
to call local you can run this command:
$ java –jar -Dspring.profiles.active=local app.jar
or, you can directly call it in the application.properties file:
spring.profiles.active=local
Upvotes: 1
Reputation: 962
Try this, it worked for me!
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=something"
Check if this article throws some light !
Maven spring boot run debug with arguments
Upvotes: 2