diff --git a/reference/html/index.html b/reference/html/index.html index 14ce0533..eb29ca3a 100644 --- a/reference/html/index.html +++ b/reference/html/index.html @@ -1543,22 +1543,14 @@ We suggest passing a DiscoveryClientServiceInstanceListSupplier del @Bean public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( - ReactiveDiscoveryClient discoveryClient, Environment environment, - LoadBalancerZoneConfig zoneConfig, - ApplicationContext context) { - DiscoveryClientServiceInstanceListSupplier firstDelegate = new DiscoveryClientServiceInstanceListSupplier( - discoveryClient, environment); - ZonePreferenceServiceInstanceListSupplier delegate = new ZonePreferenceServiceInstanceListSupplier(firstDelegate, - zoneConfig); - ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context - .getBeanProvider(LoadBalancerCacheManager.class); - if (cacheManagerProvider.getIfAvailable() != null) { - return new CachingServiceInstanceListSupplier(delegate, - cacheManagerProvider.getIfAvailable()); - } - return delegate; + ConfigurableApplicationContext context) { + return ServiceInstanceListSuppliers.builder() + .withDiscoveryClient() + .withZonePreference() + .withCaching() + .build(context); } - } +} @@ -1607,25 +1599,24 @@ We suggest passing a DiscoveryClientServiceInstanceListSupplier del @Bean public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( - ReactiveDiscoveryClient discoveryClient, Environment environment, - LoadBalancerProperties loadBalancerProperties, - ApplicationContext context, - InstanceHealthChecker healthChecker) { - DiscoveryClientServiceInstanceListSupplier firstDelegate = new DiscoveryClientServiceInstanceListSupplier( - discoveryClient, environment); - HealthCheckServiceInstanceListSupplier delegate = new HealthCheckServiceInstanceListSupplier(firstDelegate, - loadBalancerProperties, healthChecker); - ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context - .getBeanProvider(LoadBalancerCacheManager.class); - if (cacheManagerProvider.getIfAvailable() != null) { - return new CachingServiceInstanceListSupplier(delegate, - cacheManagerProvider.getIfAvailable()); + ConfigurableApplicationContext context) { + return ServiceInstanceListSuppliers.builder() + .withDiscoveryClient() + .withHealthChecks() + .withCaching() + .build(context); } - return delegate; - } } +
+
+
TIP
+
+

In order to make working on your own LoadBalancer configuration easier, we have added some utility methods in ServiceInstanceListSuppliers class.

+
+
+

3.5. Spring Cloud LoadBalancer Starter

diff --git a/reference/html/spring-cloud-commons.html b/reference/html/spring-cloud-commons.html index 14ce0533..eb29ca3a 100644 --- a/reference/html/spring-cloud-commons.html +++ b/reference/html/spring-cloud-commons.html @@ -1543,22 +1543,14 @@ We suggest passing a DiscoveryClientServiceInstanceListSupplier del @Bean public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( - ReactiveDiscoveryClient discoveryClient, Environment environment, - LoadBalancerZoneConfig zoneConfig, - ApplicationContext context) { - DiscoveryClientServiceInstanceListSupplier firstDelegate = new DiscoveryClientServiceInstanceListSupplier( - discoveryClient, environment); - ZonePreferenceServiceInstanceListSupplier delegate = new ZonePreferenceServiceInstanceListSupplier(firstDelegate, - zoneConfig); - ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context - .getBeanProvider(LoadBalancerCacheManager.class); - if (cacheManagerProvider.getIfAvailable() != null) { - return new CachingServiceInstanceListSupplier(delegate, - cacheManagerProvider.getIfAvailable()); - } - return delegate; + ConfigurableApplicationContext context) { + return ServiceInstanceListSuppliers.builder() + .withDiscoveryClient() + .withZonePreference() + .withCaching() + .build(context); } - } +}
@@ -1607,25 +1599,24 @@ We suggest passing a DiscoveryClientServiceInstanceListSupplier del @Bean public ServiceInstanceListSupplier discoveryClientServiceInstanceListSupplier( - ReactiveDiscoveryClient discoveryClient, Environment environment, - LoadBalancerProperties loadBalancerProperties, - ApplicationContext context, - InstanceHealthChecker healthChecker) { - DiscoveryClientServiceInstanceListSupplier firstDelegate = new DiscoveryClientServiceInstanceListSupplier( - discoveryClient, environment); - HealthCheckServiceInstanceListSupplier delegate = new HealthCheckServiceInstanceListSupplier(firstDelegate, - loadBalancerProperties, healthChecker); - ObjectProvider<LoadBalancerCacheManager> cacheManagerProvider = context - .getBeanProvider(LoadBalancerCacheManager.class); - if (cacheManagerProvider.getIfAvailable() != null) { - return new CachingServiceInstanceListSupplier(delegate, - cacheManagerProvider.getIfAvailable()); + ConfigurableApplicationContext context) { + return ServiceInstanceListSuppliers.builder() + .withDiscoveryClient() + .withHealthChecks() + .withCaching() + .build(context); } - return delegate; - } } +
+
+
TIP
+
+

In order to make working on your own LoadBalancer configuration easier, we have added some utility methods in ServiceInstanceListSuppliers class.

+
+
+

3.5. Spring Cloud LoadBalancer Starter