Registering a client with Eureka

Registering a client with Eureka means that a client provides it's own meta-information, such as hostname with port, health indicator URL, and homepage. Each instance of a service sends heartbeat messages to the Eureka server; if Eureka doesn't receive the heartbeat over a configurable timetable, the instance is normally removed from the registry.

Let's create the main application class annotated with @SpringBootApplication for this client application. By default, Spring Discovery Client doesn't enable, so we have to use either @EnableDiscoveryClient or @EnableEurekaClient to enable it. Here is an example Eureka client:

package com.dineshonjava.eurekaclient; import org.springframework.boot.SpringApplication; ...

Get Mastering Spring Boot 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.