【发布时间】:2020-01-31 09:03:28
【问题描述】:
我有 2 个属性文件:
- application.yml
- bootstrap.yml
我为我的应用程序嵌入了 jar 文件,并使用以下命令启动它:java -jar 'jar file path'
我需要用外部位置的文件覆盖属性文件。
试过:-Dspring.config.location=your/config/dir/ 参数,但它不起作用。
您能否告诉我如何用几个属性文件覆盖属性的正确方法?
我的 bootstrap.yml 看起来像:
spring:
application.name: app_name
profiles:
active: local
include:
cloud.consul.enabled: false
main:
web-application-type: none
---
spring:
profiles: withconsul
cloud:
config.allow-override: true
consul:
enabled: true
host: https://consul.evoil.ru
port: 443
config:
enabled: true
format: YAML
fail-fast: true
我应该重命名现有配置文件的属性文件吗?
【问题讨论】:
标签: java spring-boot properties-file