【发布时间】:2018-02-25 12:41:46
【问题描述】:
我正在尝试让我的 Spring Boot 项目使用在项目之外定义的属性。我已经尝试过文档中描述的步骤,但无法正常工作。
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
.
+- folder
+- properties
+- application.properties
+- myproject
+- src
我将它用于 VM 选项:-Dspring.config.location=file:../properties/,但它不起作用。我为spring.config.location 尝试了多个值,但没有成功(我想问题出在此处)。
【问题讨论】:
-
#1。尝试使用 VM 选项上的完整路径,例如:
-Dspring.config.location=file:/app/config/properties/。 #2。尝试使用--选项而不是 VM 选项,例如:java -jar myproject.jar --spring.config.location=file:../properties/
标签: java spring-boot properties spring-boot-configuration