My question is another question about configuration in spring boot (v 2.2.x) but I have one significant difference in my config structure in comparison to configuration in existing posts on SO about configs (i.e. spring boot external config) I have following application configurations:
--src\
--main\
--resources\
-- application.yml
-- application-local.yml
-- application-dev.yml
-- application-prod.yml
My application-prod.yml looks like:
spring:
profiles:
active: prod
include:
customization
logging:
level:
root: INFO
org.springframework: INFO
org.hibernate.SQL: INFO
org.hibernate.type: INFO
pattern:
console: '%d{yyyy-MM-dd HH:mm:ss} - %msg%n'
file: '%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n'
file: ./logs/goals-service.log
My prod config have to use (this is a business requirement) external configuration with setting of
- db connection,
- security settings
- endpoints and credentials of other services.
I would like to use standard approach and ability of spring to automatically config beans, i do not want to manually load some property file and configure all beans manually. Therefore to solve this issue i created another config application-customization.yml and link it in prod config via include (see in example above). And here i faced a problem: i am unable to select path to application-customization.yml via command line argument (-Dspring.config.location or any it variations) , but i could load customization settings when i placed my external config in directory that is used to start app (this is a behaviour of spring to search configs), and app in this case works fine. I would like to pass path of where app should search my application-customization.yml, and one more thing i can'not use symlinks from to link from actual config location to ./application-customization.yml.