Create Eureka Server Using Spring Cloud

Overview of Eureka Server:

Eureka is a discovery server where all the micro-services of a system can register, de-register and communicate between themselves. It also works as the Load Balancer between the multiple instances of a component. In this post, you will learn how to implement an Eureka Server quickly using Maven and the Spring Cloud Libraries.

The Implementation:

Eureka Server Maven Dependency:

You will find the latest maven dependency of Spring Cloud Eureka Server here.


Creating the Maven Project:

The best way to create the project is from the Spring Initializr – and follow the below steps –

  1. Select project as “Maven Project”
  2. Select Language as “Java”
  3. Select the Spring Boot Release Version (I would recommend not to use any SNAPSHOT version)
  4. Fill up the Group Name and the Artifact Name.
  5. Search Dependencies and Select “Eureka Server”
  6. Click on “Generate Project”.

The above steps will download a .zip file. Unzip it and import it in any IDE ( I use IntelliJ Free Community Edition. You can download it from IntelliJ Website )

For your convenience I am also providing the POM file below, also at the end of this article you will find the link of the full source code.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
  <relativePath/> <!-- lookup parent from repository -->
 <description>2dArray Demo Project</description>






Note : I am using the Spring Cloud version as “Greenwich.RELEASE”. As in this POM we have the “dependencyManagement” block, it will download the compatible version of “spring-cloud-starter-netflix-eureka-server” and I would recommend you to use it this way and let Spring handle the complex part. 😀

The Magic of the Annotation:

Now, you are almost done. Go to the Main file, i.e. the entry point of the Application, and you will find something like below :

package com.twodarray.eurekaserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class EurekaServerApplication {

 public static void main(String[] args) {, args);


You have to just put one annotation (@EnableEurekaServer) just above the MainClass…and you are done.

package com.twodarray.eurekaserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class EurekaServerApplication {

 public static void main(String[] args) {, args);


Build and Run:

You can build and run your project from the dedicated button of the IDE, otherwise if you are comfortable with terminal, then use the below command to build your project :

 mvn clean package

..and to run –

mvn spring-boot:run

The Dashboard:

If everything is fine, I am sure it is, you need to open Google Chrome / Safari or whatever application you are using to explore internet and go to this URL – http://localhost:8080. You will find the Eureka Dashboard running.

Eureka Server Configuration:

Here are some extra configurations from “src/main/resources/”, which are good to know – # Used as the name of the Application # The current active profile

server.port=9091 # The port where you want to run this Eureka Server. By default it is 8080


So, in this post I have shown how can you write an Eureka Server quickly and to put your first step to the micro-service architecture. You can find the full source code here in my GitHub page.

Feel free to ask any question below in the comment box. If you have liked this post… please share.

Parijat Mukherjee

Hi There !!! I am a Software Engineer and I am always in a process of learning something new. I love the works that are outside my comfort zone. Rather than focusing on a particular programming language, I try to focus on the design patterns and technologies because I believe, if someone understands the "What" and the "Why" part of a problem and the technology or tool, then the "How" part can be easily done by any of the programming language available in the market.

Recent Posts

Spring Security Architecture – Authentication

The Spring Security project is perhaps the biggest and one of the best projects so far by Spring. When I…

2 months ago

Make Use of SOLID Coding Principles

We all know what are the pros and cons of Object Oriented Programming, but what about writing better codes? What…

2 months ago

Free Birthday and Anniversary Mail Sender Software

Open Source Application to send Birthday and Anniversary greetings to the employees

3 months ago

How to Dockerize Spring Boot Applications

Article to demonstrate how to dockerize a spring boot application with all the required maven dependency plugins and Dockerfile.

4 months ago

Create a Spring Boot 2 Application & Register it in Eureka

Spring boot tutorial and a eureka client example including eureka client properties to guide the microservice beginners.

5 months ago

How to create MariaDB Galera Cluster in CentOS 6.x

Galera cluster tutorial and overview for the beginners followed by galera cluster setup centos 6 and galera cluster configuration.

2 years ago