使用 Spring Cloud Zookeeper 與 Spring Cloud Components

Feign、Spring Cloud Gateway 和 Spring Cloud LoadBalancer 皆可與 Spring Cloud Zookeeper 搭配使用。

Spring Cloud LoadBalancer 與 Zookeeper

Spring Cloud Zookeeper 提供了 Spring Cloud LoadBalancer ServiceInstanceListSupplier 的實作。當您使用 spring-cloud-starter-zookeeper-discovery 時,Spring Cloud LoadBalancer 會自動配置為預設使用 ZookeeperServiceInstanceListSupplier

如果您先前在 Zookeeper 中使用 StickyRule,則目前堆疊中的替代方案是 SC LoadBalancer 中的 SameInstancePreferenceServiceInstanceListSupplier。您可以在 Spring Cloud Commons 文件中閱讀如何設定它。