[英]Spring Cloud Config Server Not Refreshing
I'm setting up a Spring cloud server to read of an internal Stash directory.我正在设置一个 Spring 云服务器来读取内部 Stash 目录。
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).服务器第一次加载正常,但如果我更新 git 中的属性,它们不会得到反映,直到我重新启动云服务器(我尝试 POST 到 /refresh 端点)。
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.我在 Windows 上,我看到一些与 Windows 上的服务器相关的错误,但我没有看到任何关于我的错误的具体提及。
see org.springframework.cloud.bootstrap.config.RefreshEndpoint code here:在此处查看 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()]);
}
that means /refresh endpoint pull git first and then refresh catch,and public a environmentChangeEvent,so we can customer the code like this.这意味着/refresh端点先拉git然后刷新catch,并公开一个environmentChangeEvent,这样我们就可以像这样客户化代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.