spring 云配置如何使用本地 属性 覆盖远程 属性
How spring cloud config use local property override remote property
我知道应该设置以下属性,但仍然不知道应该在哪里设置它们。
spring:
cloud:
config:
allowOverride: true
failFast: true
overrideNone: false
application.properties 文件在 spring 云服务器端或客户端或远程 git 存储库?
我在服务器端 application.yml 中设置了它们,但不起作用。
我尝试在远程 git 上设置 application.yml,但还是不行,希望你能给我一些帮助,谢谢。
我在远程 git 仓库中设置了以下配置。这次成功了。
spring:
cloud:
config:
allowOverride: true
overrideNone: true
overrideSystemProperties: false
来自 Spring 云文档中的 Overriding the Values of Remote Properties 部分:
The property sources that are added to you application by the bootstrap context are often "remote" (e.g. from a Config Server), and by default they cannot be overridden locally, except on the command line. If you want to allow your applications to override the remote properties with their own System properties or config files, the remote property source has to grant it permission by setting spring.cloud.config.allowOverride=true
(it doesn’t work to set this locally).
Once that flag is set there are some finer grained settings to control the location of the remote properties in relation to System properties and the application’s local configuration: spring.cloud.config.overrideNone=true
to override with any local property source, and spring.cloud.config.overrideSystemProperties=false
if only System properties and env vars should override the remote settings, but not the local config files.
因此,它必须在远程 application.yml
中设置(例如远程 git 存储库)。如前所述 here:“应用无法自行决定是否可以覆盖来自远程源的配置”。
'spring boot app'<-- 'config-server' --> 'config-repo'
在 config-repo
的 application.properties 中设置以下属性
spring.cloud.config.allowOverride=true
spring.cloud.config.overrideNone=true
spring.cloud.config.overrideSystemProperties=false
如果远程文件是 yml 那么下面的格式
spring:
cloud:
config:
allowOverride: true
overrideNone: true
overrideSystemProperties: false
我知道应该设置以下属性,但仍然不知道应该在哪里设置它们。
spring:
cloud:
config:
allowOverride: true
failFast: true
overrideNone: false
application.properties 文件在 spring 云服务器端或客户端或远程 git 存储库?
我在服务器端 application.yml 中设置了它们,但不起作用。
我尝试在远程 git 上设置 application.yml,但还是不行,希望你能给我一些帮助,谢谢。
我在远程 git 仓库中设置了以下配置。这次成功了。
spring:
cloud:
config:
allowOverride: true
overrideNone: true
overrideSystemProperties: false
来自 Spring 云文档中的 Overriding the Values of Remote Properties 部分:
The property sources that are added to you application by the bootstrap context are often "remote" (e.g. from a Config Server), and by default they cannot be overridden locally, except on the command line. If you want to allow your applications to override the remote properties with their own System properties or config files, the remote property source has to grant it permission by setting
spring.cloud.config.allowOverride=true
(it doesn’t work to set this locally).Once that flag is set there are some finer grained settings to control the location of the remote properties in relation to System properties and the application’s local configuration:
spring.cloud.config.overrideNone=true
to override with any local property source, andspring.cloud.config.overrideSystemProperties=false
if only System properties and env vars should override the remote settings, but not the local config files.
因此,它必须在远程 application.yml
中设置(例如远程 git 存储库)。如前所述 here:“应用无法自行决定是否可以覆盖来自远程源的配置”。
'spring boot app'<-- 'config-server' --> 'config-repo'
在 config-repo
的 application.properties 中设置以下属性spring.cloud.config.allowOverride=true
spring.cloud.config.overrideNone=true
spring.cloud.config.overrideSystemProperties=false
如果远程文件是 yml 那么下面的格式
spring:
cloud:
config:
allowOverride: true
overrideNone: true
overrideSystemProperties: false