@EnableEurekaClient was a Spring Cloud Netflix annotation that marked an application as a Eureka client, so it registered with a Eureka server and could look up other services. It is deprecated: the generic @EnableDiscoveryClient replaced it, and since Spring Cloud Edgware (2017) neither annotation is required when the Eureka client starter is on the classpath. In recent Spring Cloud releases it is no longer available, so new code should not use it.
@EnableEurekaClient did@EnableEurekaClient didEureka is Netflix's service registry. A Eureka client registers its host, port and health URL with the server, sends periodic heartbeats and fetches the registry so it can find other services. @EnableEurekaClient activated this Eureka-specific behaviour. It lived in org.springframework.cloud.netflix.eureka and, unlike @EnableDiscoveryClient, worked only with Eureka.
Older code looked like this:
Add the Eureka client starter. With Spring Boot auto-configuration, no annotation is needed.
Import the Spring Cloud BOM so the starter version matches your Spring Boot version, for example through spring-cloud-dependencies in dependencyManagement. Spring Cloud release trains are tied to specific Boot versions, so check the compatibility table in the official documentation.
If you want an explicit marker in code, @EnableDiscoveryClient still works and is registry-neutral.
The server side uses a different annotation, @EnableEurekaServer, from spring-cloud-starter-netflix-eureka-server.
A standalone server must not try to register with itself, which is why the two client flags are set to false. In production you run several peers so the registry has no single point of failure.
A registered client can call another service by its application name through a load-balanced client. Spring Cloud LoadBalancer replaced Netflix Ribbon, which is no longer part of current Spring Cloud releases.
You can also inject DiscoveryClient and call getInstances("inventory-service") for lower-level access.
@EnableEurekaClient and its import.spring-cloud-starter-netflix-eureka-client.spring.application.name and eureka.client.service-url.defaultZone.Eureka still works with Spring Cloud, but it is not the only option. On Kubernetes, native service DNS or Spring Cloud Kubernetes often removes the need for a separate registry. Consul is another registry with health checks and a key-value store. Pick based on your platform, not on habit.
@EnableEurekaClient deprecated?Yes. It was superseded by @EnableDiscoveryClient and later made unnecessary by auto-configuration. Current Spring Cloud releases no longer include it, so remove it when upgrading.
Nothing is needed beyond the Eureka client starter and configuration. Optionally add @EnableDiscoveryClient for clarity.
Check that the starter is on the classpath, that eureka.client.service-url.defaultZone points at a reachable server and that eureka.client.register-with-eureka has not been set to false.
Set eureka.client.enabled=false in your test properties so no connection to a server is attempted.
@EnableEurekaClient marked a Eureka-only client and is now obsolete. Add the Eureka client starter, configure the server URL and application name, and let auto-configuration do the rest. Use @EnableDiscoveryClient only if you want an explicit, registry-neutral marker, and use Spring Cloud LoadBalancer for client-side load balancing.