Spring boot Spring引导外部配置,而不忽略打包的配置

Spring boot Spring引导外部配置,而不忽略打包的配置,spring-boot,Spring Boot,我正在开发一个SpringBootJAR应用程序,我想要的是在外部路径中找到一些配置属性。我想要这样的东西: jar将位于/home/myapps/my spring boot app.jar 要位于/apps/configuration/app/config.properties 我用layout:ZIP设置了spring boot maven插件,并尝试了不同的配置,如spring.config.location=“/apps/configuration/app/”和loader.path=

我正在开发一个SpringBootJAR应用程序,我想要的是在外部路径中找到一些配置属性。我想要这样的东西:

jar将位于
/home/myapps/my spring boot app.jar

要位于
/apps/configuration/app/config.properties

我用layout:ZIP设置了spring boot maven插件,并尝试了不同的配置,如
spring.config.location=“/apps/configuration/app/”
loader.path=“/apps/configuration/app/”
,但都没有成功

在某些情况下,它会忽略我的外部配置,在某些情况下,它会忽略我的打包配置。我不想使用Spring引导定义的层次结构,在
/config/


感谢您的帮助

根据文档:spring.config.location可以接受多个文件,因此您可以尝试以下方法:

spring.config.location=classpath:/application.properties,/apps/configuration/app/config.properties
或者只是目录:
spring.config.location=classpath:/,/apps/configuration/app/

我昨天在数百篇类似的帖子中列出了这些建议,但没有一篇有这样的建议。你是我的朋友,你是个救命恩人!谢谢,我很高兴能帮上忙:)