I'm trying to configure my Spring application.
I have in /src/main/resources
my file application.yml
. In my main class there is no @PropertySource
annotation (but I tried also using that).
I also have another file on my Windows (/c/Programs/application.yml
) that has similar content (some values are overriden).
I have to run application with following cmd call (my organization doesn't want me to use another call, because it part of CI/CD standard process):
java -Dspring.config.location=classpath:/application.yml,/c/Programs/application.yml -jar app.jar
My /src/main/resurces/application.yml
file is included with .jar
after building app. Running app with cmd above uses keys from resources
, not from second file.
As I gathered from few hours of trying to solve this:
- with two files
spring.config.location
, second one overrides values from first one, - files should be separated by comma,
- I don't have to use
spring.config.name
, when I specify single file (not directory).
What is the problem with my configuration? How can I override file from resources with external file?