diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java index 3d0668fe..c6aa0f85 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java @@ -145,7 +145,7 @@ public final class ServiceInstanceListSupplierBuilder { public ServiceInstanceListSupplierBuilder withHealthChecks() { DelegateCreator creator = (context, delegate) -> { ReactiveLoadBalancer.Factory loadBalancerClientFactory = context - .getBean(LoadBalancerClientFactory.class); + .getBean(LoadBalancerClientFactory.class); WebClient.Builder webClient = context.getBean(WebClient.Builder.class); return healthCheckServiceInstanceListSupplier(webClient.build(), delegate, loadBalancerClientFactory); }; @@ -268,7 +268,7 @@ public final class ServiceInstanceListSupplierBuilder { } this.cachingCreator = (context, delegate) -> { ObjectProvider cacheManagerProvider = context - .getBeanProvider(LoadBalancerCacheManager.class); + .getBeanProvider(LoadBalancerCacheManager.class); if (cacheManagerProvider.getIfAvailable() != null) { return new CachingServiceInstanceListSupplier(delegate, cacheManagerProvider.getIfAvailable()); } @@ -334,7 +334,8 @@ public final class ServiceInstanceListSupplierBuilder { ReactiveLoadBalancer.Factory loadBalancerClientFactory) { return new HealthCheckServiceInstanceListSupplier(delegate, loadBalancerClientFactory, (serviceInstance, healthCheckPath) -> webClient.get() - .uri(UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)).build().toUri()) + .uri(UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)).build() + .toUri()) .exchange().flatMap(clientResponse -> clientResponse.releaseBody() .thenReturn(HttpStatus.OK.equals(clientResponse.statusCode())))); } @@ -344,12 +345,11 @@ public final class ServiceInstanceListSupplierBuilder { ReactiveLoadBalancer.Factory loadBalancerClientFactory) { return new HealthCheckServiceInstanceListSupplier(delegate, loadBalancerClientFactory, (serviceInstance, healthCheckPath) -> Mono.defer(() -> { - URI uri = UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)) - .build() - .toUri(); + URI uri = UriComponentsBuilder.fromUriString(getUri(serviceInstance, healthCheckPath)).build() + .toUri(); try { return Mono - .just(HttpStatus.OK.equals(restTemplate.getForEntity(uri, Void.class).getStatusCode())); + .just(HttpStatus.OK.equals(restTemplate.getForEntity(uri, Void.class).getStatusCode())); } catch (Exception ignored) { return Mono.just(false);