WEB-INF
--application.yml (contains default properties)
External Folder custom-config
customNameConfig-DEV.yml
在我的春季Boot应用程序类中:
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder){
//props=HashMap
props.put("spring.config.name","customNameConfig");
props.put("spring.config.location"."file:/custom-config/,classpath:/application.yml");
builder.properties(props).sources(MyAppliocation).web(WebApplicationType.Servlet);
}
它可以从
读取属性 customNameConfig-DEV.yml
放在外部(战争之外)
不检测application.yml
之类的logging.config:file:/log4j2.json
中的属性
“ spring.config.location
”上的相同设置。“ file:/custom-config/,classpath:/application.yml
”工作正常
当我运行时,它是 java -jar myapp.jar
到目前为止,我已经尝试过:
"spring.config.location" = "file:/custom-config/,classpath:**/a**pplication.yml"
"spring.config.location" = "file:/custom-config/,classpath:**a**pplication.yml"
"spring.config.location" = "file:/custom-config/,classpath**:WEB**-INF/classes/application.yml"
"spring.config.location" = "file:/custom-config/,classpath:**/W**EB-INF/classes/application.yml"
"spring.config.additional-location" : "file::/custom-config/"
"spring.config.location" = "classpath:/application.yml"
:(伤了我的头
应该怎么解决?