使用 Profile 覆蓋屬性
覆蓋來自 Config Server 的屬性的最後一種方法是在客戶端應用程式中的 profile 特定配置檔案中指定它們。
例如,如果您從 Config Server 獲取了以下配置
hello="Hello From Config Server!"
您可以透過在 profile 特定配置檔案中設定 hello
並啟用該 profile 來覆蓋客戶端應用程式中 hello
的值。
application-overrides.properties
hello="Hello From Application!"
在上面的示例中,您必須啟用 overrides
profile。