简体   繁体   中英

Spring Cloud Config Server Not Refreshing

I'm setting up a Spring cloud server to read of an internal Stash directory.

The server loads up ok the first time, but if I update properties in git, they don't get reflected until I restart cloud server (I try POST to /refresh endpoint).

I'm on Windows and I see a few bugs related to server on Windows but I don't see any specific mention of my bug.

see org.springframework.cloud.bootstrap.config.RefreshEndpoint code here:

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()]);
}

that means /refresh endpoint pull git first and then refresh catch,and public a environmentChangeEvent,so we can customer the code like this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM