Search code examples
spring-cloudcircuit-breakerresilience4j

Use Annotation with Spring Cloud Circuit Breaker - Resilience4j


Is it possible to use Resilience4j on Spring Cloud Circuit Breaker by annotation? I can't find any documentation about it but only examples about using resilience4j by code


Solution

  • I don't think Spring Cloud Circuit Breaker offers annotations at this time. However, you may use the Spring Boot starter of Resilience4J (not part of Spring Cloud). This Resilience4J starter allows, among other features, to use annotations.

    Please note that when using the Resilience4J starter, you lose the layer of abstraction offered by Spring Cloud Circuit Breaker (i.e. to replace resilience4j by another implementation). Also, if you decide to use the Resilience4J starter, you might want to reconsider whether Spring Cloud Circuit Breaker is still needed.