From 9feb443009dd7964aae7182284a0f8f552ea9b8e Mon Sep 17 00:00:00 2001 From: "Zhiguo.Chen" Date: Tue, 27 Jul 2021 18:39:27 +0800 Subject: [PATCH] Add `with()` method to support external ServiceInstanceListSupplier(#988) (#989) --- .../core/ServiceInstanceListSupplierBuilder.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 02843f6c..36cf2543 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 @@ -45,6 +45,7 @@ import org.springframework.web.util.UriComponentsBuilder; * * @author Spencer Gibb * @author Olga Maciaszek-Sharma + * @author Zhiguo Chen */ public final class ServiceInstanceListSupplierBuilder { @@ -248,6 +249,19 @@ public final class ServiceInstanceListSupplierBuilder { return this; } + /** + * Support {@link ServiceInstanceListSupplierBuilder} can be added to the expansion implementation of + * {@link ServiceInstanceListSupplier} by this method. + * @param delegateCreator a {@link DelegateCreator} object + * @return the {@link ServiceInstanceListSupplierBuilder} object + */ + public ServiceInstanceListSupplierBuilder with(DelegateCreator delegateCreator) { + if (delegateCreator != null) { + creators.add(delegateCreator); + } + return this; + } + /** * Builds the {@link ServiceInstanceListSupplier} hierarchy. * @param context application context