如何在功能区负载均衡器中设置 ServerListRefreshInterval?

How to set ServerListRefreshInterval in ribbon load balancer?

我正在使用 Spring、Eureka 和 Ribbon。我想更改功能区的刷新间隔。在阅读文档时,我发现我应该设置以下 属性:

my-service.ribbon.ServerListRefreshInterval=99999

但是,它没有帮助,因为当我创建负载平衡器时,Spring 使用以下构造函数

   public DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, 
        ServerList<T> serverList, ServerListFilter<T> filter) {
    this(
            clientConfig,
            rule,
            ping,
            serverList,
            filter,
            new PollingServerListUpdater()
    );

而且这个构造函数没有使用我的属性。

我看过这个话题:

问题与此错误有关:ribbon.ServerListRefreshInterval ignored #1304

该错误已于 2017 年 3 月 spring-cloud-netflix 1.3.0.RC1 解决。

您正在使用 Spring Cloud Camden.SR7,它使用 Spring Cloud Netflix 1.2.7.RELEASE,其中错误尚未修复。

要么强制使用 spring-cloud-netflix 1.3.0 或更高版本,要么切换到使用 Spring Cloud Netflix 1.4.3.RELEASE

Spring Cloud version that contains this kind of dependency, e.g Spring Cloud Edgware.SR2 (Maven repo)