Spring boot microservices with Eureka server

Kapila Nishantha
2 min readApr 16, 2019

--

Today one of most popular topic is microservice architecture. Microservice can be write using Nodejs, Java, Python, etc.. In this article i will explain Writing java microservice using Spring boot and intercommunication between those microservice using Eureka service discovery server.

Diagram 1

Diagram 1 will explain .

  1. Client send the request to API Gateway.
  2. API gateway route that request to the discovery service.
  3. Discovery service will route request to consumer service.
  4. Consumer service send database service request to discover service.
  5. Discover service will send request to database service.
  6. Database service response and discover service will response to the consumer service.
  7. Consumer service respond to the discover service and respond to the API gateway.
  8. API gateway respond to the Client.

What is service discovery ?

Service discovery is the automatic detection of service offered by service cluster.In this example i’m using Eureka discovery server as a microservice.

How to setup Eureka server as a microservice ?

Create simple maven project and add following dependencies to pom.xml file.

  • Add parent tag
  • Add netflix eureka server dependancy.
  • Add spring cloud dependency under dependency management tag.

Create application.java class file and add following annotations.

Create property file and add following properties.

Now try on http://localhost:8090/ . You should get following result.

Browser result page

--

--

Responses (1)