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; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @EnableEurekaClient public class EurekaClientApplication { public static void...