Spring Boot Eureka Server is a service registry that enables service discovery in a microservices architecture. It allows microservices to register themselves and discover other services dynamically. This guide will walk you through setting up and configuring a Spring Boot Eureka Server.
Written by
Şuayb Şimşek
Backend-focused fullstack developer sharing practical notes on Spring Boot, security, microservices, and cloud-native architecture.
The sample below provides a minimal client implementation so you can validate the server integration end to end.
▶️ Running the Client Application
Run the Eureka Client application:
BASH
./mvnw spring-boot:run
or using Gradle:
BASH
gradle bootRun
Check if the client has registered with Eureka Server by visiting:
BASH
http://localhost:8761/
🏁 Conclusion
You now have a practical Spring Boot Eureka Server implementation with a clear, production-friendly Spring Boot structure. As a next step, adapt configuration and tests to your own domain, then validate behavior under realistic traffic and failure scenarios.
JAVAEurekaServerApplication.java
package com.example.eurekaserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
KOTLINEurekaServerApplication.kt
package com.example.eurekaserver
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer
@SpringBootApplication
@EnableEurekaServer
class EurekaServerApplication
fun main(args: Array<String>) {
runApplication<EurekaServerApplication>(*args)
}
JAVAEurekaClientApplication.java
package com.example.eurekaclient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
@RequestMapping("/client")
public class EurekaClientApplication {
@GetMapping
public String getClientMessage() {
return "Hello from Eureka Client!";
}
public static void main(String[] args) {
SpringApplication.run(EurekaClientApplication.class, args);
}
}
KOTLINEurekaClientApplication.kt
package com.example.eurekaclient
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@SpringBootApplication
@RestController
@RequestMapping("/client")
class EurekaClientApplication {
@GetMapping
fun getClientMessage(): String {
return "Hello from Eureka Client!"
}
}
fun main(args: Array<String>) {
runApplication<EurekaClientApplication>(*args)
}