org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory Java Examples
The following examples show how to use
org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyLoadBalancerConfiguration.java From spring-cloud-alibaba with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public ReactorLoadBalancer<ServiceInstance> reactorServiceInstanceLoadBalancer( Environment environment, LoadBalancerClientFactory loadBalancerClientFactory) { String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME); return new RandomLoadBalancer(loadBalancerClientFactory.getLazyProvider(name, ServiceInstanceListSupplier.class), name); }
Example #2
Source File: GatewayReactiveLoadBalancerClientAutoConfiguration.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnBean(LoadBalancerClientFactory.class) @ConditionalOnMissingBean(ReactiveLoadBalancerClientFilter.class) public ReactiveLoadBalancerClientFilter gatewayLoadBalancerClientFilter( LoadBalancerClientFactory clientFactory, LoadBalancerProperties properties) { return new ReactiveLoadBalancerClientFilter(clientFactory, properties); }
Example #3
Source File: LoadBalancerClientConfiguration.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public ReactorLoadBalancer<ServiceInstance> reactorServiceInstanceLoadBalancer( Environment environment, LoadBalancerClientFactory loadBalancerClientFactory) { String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME); return new RoundRobinLoadBalancer(loadBalancerClientFactory.getLazyProvider(name, ServiceInstanceListSupplier.class), name); }
Example #4
Source File: BlockingLoadBalancerClientAutoConfiguration.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnBean(LoadBalancerClientFactory.class) @ConditionalOnMissingBean public LoadBalancerClient blockingLoadBalancerClient( LoadBalancerClientFactory loadBalancerClientFactory) { return new BlockingLoadBalancerClient(loadBalancerClientFactory); }
Example #5
Source File: LoadBalancerAutoConfiguration.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
@ConditionalOnMissingBean @Bean public LoadBalancerClientFactory loadBalancerClientFactory() { LoadBalancerClientFactory clientFactory = new LoadBalancerClientFactory(); clientFactory.setConfigurations( this.configurations.getIfAvailable(Collections::emptyList)); return clientFactory; }
Example #6
Source File: LoadBalancerTests.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
@Bean public RoundRobinLoadBalancer roundRobinContextLoadBalancer( LoadBalancerClientFactory clientFactory, Environment env) { String serviceId = clientFactory.getName(env); return new RoundRobinLoadBalancer(clientFactory.getLazyProvider(serviceId, ServiceInstanceListSupplier.class), serviceId, -1); }
Example #7
Source File: FeignClientFactoryTests.java From spring-cloud-openfeign with Apache License 2.0 | 4 votes |
@Bean BlockingLoadBalancerClient loadBalancerClient() { return new BlockingLoadBalancerClient(new LoadBalancerClientFactory()); }
Example #8
Source File: LoadBalancerAutoConfiguration.java From spring-cloud-loadbalancer with Apache License 2.0 | 4 votes |
@Bean public LoadBalancerClientFactory loadBalancerClientFactory() { LoadBalancerClientFactory clientFactory = new LoadBalancerClientFactory(); clientFactory.setConfigurations(configurations.getIfAvailable(Collections::emptyList)); return clientFactory; }
Example #9
Source File: RoundRobinLoadBalancer.java From spring-cloud-loadbalancer with Apache License 2.0 | 4 votes |
public RoundRobinLoadBalancer(LoadBalancerClientFactory clientFactory, Environment environment) { this.clientFactory = clientFactory; this.environment = environment; }
Example #10
Source File: LoadBalancerTest.java From spring-cloud-loadbalancer with Apache License 2.0 | 4 votes |
@Bean public RoundRobinLoadBalancer roundRobinContextLoadBalancer(LoadBalancerClientFactory clientFactory, Environment env) { return new RoundRobinLoadBalancer(clientFactory, env); }
Example #11
Source File: SpringCloudLoadBalancerAutoConfiguration.java From spring-cloud-contract with Apache License 2.0 | 4 votes |
@Bean @Primary LoadBalancerClientFactory stubRunnerLoadBalancerClientFactory( BeanFactory beanFactory) { return new StubRunnerLoadBalancerClientFactory(beanFactory); }
Example #12
Source File: ReactiveLoadBalancerClientFilter.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
public ReactiveLoadBalancerClientFilter(LoadBalancerClientFactory clientFactory, LoadBalancerProperties properties) { this.clientFactory = clientFactory; this.properties = properties; }
Example #13
Source File: BlockingLoadBalancerClient.java From spring-cloud-commons with Apache License 2.0 | 4 votes |
public BlockingLoadBalancerClient( LoadBalancerClientFactory loadBalancerClientFactory) { this.loadBalancerClientFactory = loadBalancerClientFactory; }
Example #14
Source File: CachingServiceInstanceListSupplierTests.java From spring-cloud-commons with Apache License 2.0 | 4 votes |
@Bean LoadBalancerClientFactory loadBalancerClientFactory() { return new LoadBalancerClientFactory(); }
Example #15
Source File: CachingServiceInstanceListSupplierTests.java From spring-cloud-commons with Apache License 2.0 | 4 votes |
@Bean BlockingLoadBalancerClient blockingLoadBalancerClient( LoadBalancerClientFactory loadBalancerClientFactory) { return new BlockingLoadBalancerClient(loadBalancerClientFactory); }