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 ...