Spring Boot Tutorial 0/110 lessons ~6 min read Lesson 68

    Service Discovery / Eureka

    In a microservices world, services come and go.

    Course progress0%
    Focus
    2 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    In a microservices world, services come and go. Service discovery answers where is the orders service right now?. Eureka is Netflix's classic registry; Consul and Kubernetes' built-in DNS are common alternatives.

    Informative example

    bash
    # Eureka Server
    @SpringBootApplication
    @EnableEurekaServer
    public class DiscoveryApp { public static void main(String[] a){ SpringApplication.run(DiscoveryApp.class,a);} }
    # application.yml (eureka server)
    server.port: 8761
    eureka:
    client:
    register-with-eureka: false
    fetch-registry: false
    # Each service (client)
    @SpringBootApplication
    public class OrdersApp { ... }
    # application.yml
    spring:
    application:
    name: orders-service
    eureka:
    client:
    service-url:
    defaultZone: http://discovery:8761/eureka
    Ready to mark this lesson complete?Track your journey across the entire course.