Search code examples
springspring-cloud

Migrate @EnableCircuitBreaker and @EnableEurekaClient to Spring Cloud 2022.0.1


I upgraded Spring Cloud version to 2022.0.1 and I get error for imports not found:

import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

Application class:

@EnableEurekaClient
@EnableCircuitBreaker

Do you know how I can properly import them or upgrade them?


Solution

  • since Spring boot 2.5.12 @EnableCircuitBreaker is Deprecated, So you don't need to use it. Also, this happened to @EnableEurekaClient and there is no need to annotate it Just add these two dependencies to the project

    spring-cloud-starter-circuitbreaker-resilience4j
    org.springframework.cloud:spring-cloud-starter-netflix-eureka-client