Spring Boot外部配置不会忽略打包配置

Dej*_*ski 2 spring-boot

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

罐子位于 /home/myapps/my-spring-boot-app.jar

配置位于 /apps/configuration/app/config.properties

我已经设置了弹簧引导Maven的插件与布局:拉链和我有一样不同的配置尝试spring.config.location="/apps/configuration/app/"loader.path="/apps/configuration/app/"并没有奏效.

在某些情况下,它忽略了我的外部配置,在某些情况下,它忽略了我的打包配置.我不想使用Spring Boot定义的层次结构来进行配置./config/

谢谢您的帮助

小智 6

根据文档:https: //docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html spring.config.location可以接受多个文件,所以你可以尝试这样的事情:

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