Issue
I have application-dev.properties
and application-local.properties
in the root of my class path. Inside the properties files are my datasource properties. But they are not being loaded even though we start the app with
java -Dspring.profiles.active=local -jar myJarApp.jar
Thanks
Solution
Try passing the argument as shown below:
$ java -jar xyz.jar --spring.profiles.active="dev"
Instead of using the -D flag.
Alternatively, you can set the following environment variable in your console/prompt, and then run the java -jar xyz.jar
without passing any parameters
export SPRING_PROFILES_ACTIVE=dev
That should work.
Reference:
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
Answered By - Kartik Pandya
Answer Checked By - David Marino (JavaFixing Volunteer)