In previous articles, Spring Cloud: How to Deal with Microservice Configuration (Part 1) and Spring Cloud: How to Deal with Microservice Configuration (Part 2), we have seen how to deal with microservices remote configuration. In this post, we are going to talk about another important feature in the context of microservices, namely Service Discovery. Service Discovery plays the role of a central registry in which all the services store their metadata information and from which they can get the metadata of other services.
The service discovery feature is implemented by a server and a corresponding client counterpart. In this article, we are going to describe how to configure a discovery server and make the client services able to reach it and use it. We will also see how to set a configuration based on the so-called “zone affinity.”