I have a spring boot application.
I have three profiles in my application-> development, staging and production. So I have 3 files
My application.yml resides inside src/main/resources
. I have set the active profile in application.yml as :
spring:
profiles.active: development
The other 3 profile specific config files are present in C:\config
folder.
I am using gradle plugin for eclipse. When I try to do a "bootRun", I am setting the command line arguments in my gradle configuration in eclipse as
-Dspring.profiles.active=staging -Dspring.config.location=C:\Config
However, the command line property is not getting reflected and my active profile is always getting set as development(which is the one that I have mentioned in the applications.yml file). Also C:\Config folder is not searched for profile specific config files.
I think I am missing something here. I have been trying to figure it out for the past 2 days. But no luck. I would really appreciate any help.
There are two different ways you can add/override spring properties on the command line.
It's important that the -D parameters are before your application.jar otherwise they are not recognized.
java -jar -Dspring.profiles.active=prod application.jar