对于最新的稳定版本,请使用 Spring Cloud Zookeeper 4.3.0spring-doc.cadn.net.cn

将 Spring Cloud Zookeeper 与 Spring Cloud 组件一起使用

Feign、Spring Cloud Gateway 和 Spring Cloud LoadBalancer 都与 Spring Cloud Zookeeper 配合使用。spring-doc.cadn.net.cn

Spring Cloud LoadBalancer 与 Zookeeper

Spring Cloud Zookeeper 提供了 Spring Cloud LoadBalancer 的实现ServiceInstanceListSupplier. 当您使用spring-cloud-starter-zookeeper-discovery,Spring Cloud LoadBalancer 会自动配置为使用ZookeeperServiceInstanceListSupplier默认情况下。spring-doc.cadn.net.cn

如果您之前在 Zookeeper 中使用 StickyRule,则在当前堆栈中替换它 是SameInstancePreferenceServiceInstanceListSupplier在 SC LoadBalancer 中。您可以在 Spring Cloud Commons 文档中阅读如何设置它。