將 Spring Cloud Zookeeper 與 Spring Cloud 元件一起使用

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 文件中閱讀有關如何設定它的資訊。