how to read custom property files with command line argument in a spring boot application
问题 when startup my spring boot application, I want to set a custom config file path by using command line argument, for example: java -jar some.jar -DConfigPath=conf/config.local(or conf/config.prod) So how to read this file to generate a spring configuration? Can I use the Annotation @PropertySource in some "dynamic" way? 回答1: Ok, I find the annotation @PropertySource can get the value injected by command line argument @Configuration @ConfigurationProperties @PropertySource(value = "file:$