Connecting the service consumer microservice with Eureka

The Eureka starter project needs to be added as a dependency in the pom.xml file of the service consumer microservice:

    <dependency>      <groupId>org.springframework.cloud</groupId>      <artifactId>spring-cloud-starter-eureka</artifactId>    </dependency>

Currently, the URLs of the different instances of Microservice A are hardcoded in the service consumer microservice, as shown here, in application.properties:

    microservice-a.ribbon.listOfServers=      http://localhost:8080,http://localhost:8081

However, now we would not want to hardcode Microservice A URLs. We would want the service consumer microservice to get the URLs from Eureka Server. We do that by configuring the URL of Eureka Server in the ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.