簡體   English   中英

Spring Cloud 配置服務器不刷新

[英]Spring Cloud Config Server Not Refreshing

我正在設置一個 Spring 雲服務器來讀取內部 Stash 目錄。

服務器第一次加載正常,但如果我更新 git 中的屬性,它們不會得到反映,直到我重新啟動雲服務器(我嘗試 POST 到 /refresh 端點)。

我在 Windows 上,我看到一些與 Windows 上的服務器相關的錯誤,但我沒有看到任何關於我的錯誤的具體提及。

在此處查看 org.springframework.cloud.bootstrap.config.RefreshEndpoint 代碼:

public synchronized String[] refresh() {
    Map<String, Object> before = extract(context.getEnvironment()
            .getPropertySources());
    addConfigFilesToEnvironment();
    Set<String> keys = changes(before,
            extract(context.getEnvironment().getPropertySources())).keySet();
    scope.refreshAll();
    if (keys.isEmpty()) {
        return new String[0];
    }
    context.publishEvent(new EnvironmentChangeEvent(keys));
    return keys.toArray(new String[keys.size()]);
}

這意味着/refresh端點先拉git然后刷新catch,並公開一個environmentChangeEvent,這樣我們就可以像這樣客戶化代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM