No comments yet

Spring Microservices with Netflix Stack – Create the Eureka Server

[Social9_Share type="horizontal"]

This is a series of posts to learn about spring microservices using Netflix stack. Lets talk about service registry(Eureka Server), RESTful services, the feign clients. I am dividing this series in to five parts as given below

  • Create a service registry – Using Eureka
  • Create and register a restful service – Eureka Client
  • Access the restful service – using Feign Client
  • Route and Filter requests to a microservice – Using Netflix Zuul library
  • Using HyStrix Circuit Breaker

Service Registry

The service registry is like a telephone directory of web services. The RESTful webservices can register themselves to the registry or search for other services in the same registry. Spring Cloud supports integration of RESTful services with NetFlix Eureka, Consul or Zookeeper. I am using Eureka as my service registry


Eureka is a REST (Representational State Transfer) based service that is primarily used in the AWS cloud for locating services for the purpose of load balancing and failover of middle-tier servers. – from github Netflix Eureka

In simple terms Eureka is a service registry where the microservices can be registered and make the server and other services aware of it.

In this post, let us create the EurekaServer. I am using maven for configuration and eclipse.

Creating a service Registry – Eureka Server

Create a spring boot application using spring starter project in eclipse or from I am giving the artifact name as eureka-service. Add Eureka-Server as dependency. The application is created and gets downloaded. Now, import this as a maven project in eclipse.



The dependency that is added for Eureka server in pom.xml


I am using YAML for adding configuration details. Create application.yml inside src/main/resources. I am giving the application name, server port number and service url.

Main Class

Annotate the main class with @EnableEurekaServer

Run the application as Spring Boot App. This will start up the eureka server in http://localhost:8761. You can see the admin console of Spring Eureka. You can also notice that at present no services are registered with the registry.


That’s it. Now that we have configured the server, lets move on to Part-II, creating a REStful service and registering it to eureka server.

Post a comment