Class ServiceInstanceListSupplierBuilder
- java.lang.Object
-
- org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplierBuilder
-
public final class ServiceInstanceListSupplierBuilder extends Object
A Builder for creating aServiceInstanceListSupplierhierarchy to be used inReactorLoadBalancerconfiguration.- Author:
- Spencer Gibb, Olga Maciaszek-Sharma, Zhiguo Chen, Sabyasachi Bhattacharya
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceServiceInstanceListSupplierBuilder.CreatorAllows creating aServiceInstanceListSupplierinstance based on providedConfigurableApplicationContext.static interfaceServiceInstanceListSupplierBuilder.DelegateCreatorAllows creating aServiceInstanceListSupplierinstance based on providedConfigurableApplicationContextand anotherServiceInstanceListSupplierinstance that will be used as a delegate.
-
Method Summary
-
-
-
Method Detail
-
withBlockingDiscoveryClient
public ServiceInstanceListSupplierBuilder withBlockingDiscoveryClient()
Sets a blockingDiscoveryClient-basedDiscoveryClientServiceInstanceListSupplieras a baseServiceInstanceListSupplierin the hierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withDiscoveryClient
public ServiceInstanceListSupplierBuilder withDiscoveryClient()
Sets aReactiveDiscoveryClient-basedDiscoveryClientServiceInstanceListSupplieras a baseServiceInstanceListSupplierin the hierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withBase
public ServiceInstanceListSupplierBuilder withBase(ServiceInstanceListSupplier supplier)
Sets a user-providedServiceInstanceListSupplieras a baseServiceInstanceListSupplierin the hierarchy.- Parameters:
supplier- a user-providedServiceInstanceListSupplierinstance- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withHealthChecks
public ServiceInstanceListSupplierBuilder withHealthChecks()
Adds aHealthCheckServiceInstanceListSupplierto theServiceInstanceListSupplierhierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withHealthChecks
public ServiceInstanceListSupplierBuilder withHealthChecks(org.springframework.web.reactive.function.client.WebClient webClient)
Adds aHealthCheckServiceInstanceListSupplierthat uses user-providedWebClientinstance to theServiceInstanceListSupplierhierarchy.- Parameters:
webClient- a user-providedWebClientinstance- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withSameInstancePreference
public ServiceInstanceListSupplierBuilder withSameInstancePreference()
Adds aSameInstancePreferenceServiceInstanceListSupplierto theServiceInstanceListSupplierhierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withBlockingHealthChecks
public ServiceInstanceListSupplierBuilder withBlockingHealthChecks()
Adds aHealthCheckServiceInstanceListSupplierthat uses user-providedRestTemplateinstance to theServiceInstanceListSupplierhierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withBlockingHealthChecks
public ServiceInstanceListSupplierBuilder withBlockingHealthChecks(org.springframework.web.client.RestTemplate restTemplate)
Adds aHealthCheckServiceInstanceListSupplierthat uses user-providedRestTemplateinstance to theServiceInstanceListSupplierhierarchy.- Parameters:
restTemplate- a user-providedRestTemplateinstance- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withZonePreference
public ServiceInstanceListSupplierBuilder withZonePreference()
Adds aZonePreferenceServiceInstanceListSupplierto theServiceInstanceListSupplierhierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withZonePreference
public ServiceInstanceListSupplierBuilder withZonePreference(String zoneName)
Adds aZonePreferenceServiceInstanceListSupplierto theServiceInstanceListSupplierhierarchy.- Parameters:
zoneName- desired zone for zone preference- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withRequestBasedStickySession
public ServiceInstanceListSupplierBuilder withRequestBasedStickySession()
Adds aRequestBasedStickySessionServiceInstanceListSupplierto theServiceInstanceListSupplierhierarchy.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withCaching
public ServiceInstanceListSupplierBuilder withCaching()
IfLoadBalancerCacheManageris available in the context, adds aCachingServiceInstanceListSupplierinstance to theServiceInstanceListSupplierhierarchy to provide a caching mechanism for service instances. UsesObjectProviderto lazily resolveLoadBalancerCacheManager.- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
withRetryAwareness
public ServiceInstanceListSupplierBuilder withRetryAwareness()
-
withHints
public ServiceInstanceListSupplierBuilder withHints()
-
with
public ServiceInstanceListSupplierBuilder with(ServiceInstanceListSupplierBuilder.DelegateCreator delegateCreator)
SupportServiceInstanceListSupplierBuildercan be added to the expansion implementation ofServiceInstanceListSupplierby this method.- Parameters:
delegateCreator- aServiceInstanceListSupplierBuilder.DelegateCreatorobject- Returns:
- the
ServiceInstanceListSupplierBuilderobject
-
build
public ServiceInstanceListSupplier build(org.springframework.context.ConfigurableApplicationContext context)
Builds theServiceInstanceListSupplierhierarchy.- Parameters:
context- application context- Returns:
- a
ServiceInstanceListSupplierinstance on top of the delegate hierarchy
-
-