I have created 2 files under src/main/resources:
- application.properties
- application-local.properties
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?
CodePudding user response:
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
CodePudding user response:
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
CodePudding user response:
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