ProLesson 4.2Intermediate3 min readUpdated 31 October 2026
Netflix Eureka Architecture: Server & Client
Set up a Netflix Eureka Service Registry and register Spring Boot 3 microservices with automatic heartbeats.
Netflix Eureka is the premier client-side service discovery registry in the Spring Cloud ecosystem.
It consists of two main components:
- Eureka Server: The phonebook / directory where all microservices register their current network location (IP and port).
- Eureka Client: The background agent embedded in every microservice that registers upon startup, sends periodic heartbeats, and fetches the latest directory list.
Let's build both components using Spring Boot 3 and Spring Cloud 2023+.
01Creating the Eureka Server
Maven Dependency (pom.xml):
xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>Main Application Class:
Annotate the main class with @EnableEurekaServer:
java
package com.veltoryx.registry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer // Activates the Eureka Service Registry
public class ServiceRegistryApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceRegistryApplication.class, args);
}
}Configuration (application.yml):
Because Eureka Server is itself a Spring Boot application, you must instruct it not to register with itself as a client:
yaml
server:
port: 8761 # Default standard Eureka port
spring:
application:
name: SERVICE-REGISTRY
eureka:
instance:
hostname: localhost
client:
# Do not register the server itself in its own registry
register-with-eureka: false
# Do not fetch registry from peers (in single-node development)
fetch-registry: false
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/Launch the application and navigate to http://localhost:8761. You will see the Eureka Web Dashboard displaying registered instances.
Loading the rest of the lesson…