4. 将 Spring Cloud Zookeeper 与 Spring Cloud 组件一起使用
Feign、Spring Cloud Gateway 和 Spring Cloud LoadBalancer 都可以与 Spring Cloud Zookeeper 一起使用。
4.1. 带有 Zookeeper 的 Spring Cloud LoadBalancer
Spring Cloud Zookeeper 提供了 Spring Cloud LoadBalancer 的实现ServiceInstanceListSupplier
.
当您使用spring-cloud-starter-zookeeper-discovery
,Spring Cloud LoadBalancer 会自动配置为使用ZookeeperServiceInstanceListSupplier
默认情况下。
如果您之前在 Zookeeper 中使用 StickyRule,则它在当前堆栈中的替换
是SameInstancePreferenceServiceInstanceListSupplier 在 SC LoadBalancer 中。您可以在 Spring Cloud Commons 文档中阅读如何设置它。 |