Skip to Main Content
Spring 5.0 By Example
book

Spring 5.0 By Example

by Claudio Eduardo de Oliveira
February 2018
Intermediate to advanced content levelIntermediate to advanced
356 pages
9h 10m
English
Packt Publishing
Content preview from Spring 5.0 By Example

Service discovery and load balancing in practice

Now we will write some code to interact with our service discovery and load balance infrastructure. Now we know how it works, it will help us to understand the source code.

We will create a DiscoveryService class which will discover the addresses from a requested service name. The class code should be like this:

package springfive.airline.airlineflights.service;import org.springframework.cloud.client.discovery.DiscoveryClient;import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;import org.springframework.stereotype.Service;import reactor.core.publisher.Flux;import reactor.core.publisher.Mono;@Servicepublic class DiscoveryService {  private final LoadBalancerClient lbClient ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Spring

Beginning Spring

Mert Caliskan, Kenan Sevindik, Rod Johnson, Jürgen Höller
Mastering Spring 5.0

Mastering Spring 5.0

In28Minutes Official
Spring 5.0 Cookbook

Spring 5.0 Cookbook

Sherwin John Calleja Tragura

Publisher Resources

ISBN: 9781788624398Supplemental Content