question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CircuitBreaker annotation does not work on methods

See original GitHub issue

Resilience4j version: 1.2.0 Java version: 1.8 Problem description: CircuitBreaker annotation is working when applied on methods. It works perfected when applied on class.

I am using spring-boot 2.0.2 Using resilence4j dependency: resilience4j-spring-boot2:1.2.0

I found this was working with spring-boot 1.5 and resilience4j-spring-boot:0.17.0

Example: the below one works

@Component(value = "backendAConnector")
@CircuitBreaker(name = "backendA")
public class BackendAConnector {

    public String success() {
        return "Hello World from backend A";
    }
}

the below one doesn’t work

@Component(value = "backendAConnector")
public class BackendAConnector {

    @CircuitBreaker(name = "backendA")
    public String success() {
        return "Hello World from backend A";
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

13reactions
warrior107commented, Apr 16, 2020

Sorry for the delayed response. I was calling the method incorrectly. Since resilience4j annotation are AOP based. I was calling the methods from within the BackendAConnector class. It started working when I called the function from different class and using the object as bean.

2reactions
warrior107commented, Dec 15, 2019

Found the issue why is was not working. Closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resilience4j Circuit Breaker is not working - Stack Overflow
Try using the following yaml file I used the following configuration with your existing code,I used yaml instead of properties file. this seems ......
Read more >
Resilience4j Tutorial with Spring Boot | Circuit Breaker, Retry ...
In this tutorial, we will implement Resilience4j with Spring boot and different modules available for it. We will see the theory part and ......
Read more >
Getting Started - resilience4j
RateLimiter, Retry, CircuitBreaker and Bulkhead annotations support synchronous return types and asynchronous types like CompletableFuture and reactive types ...
Read more >
Resilience4J: Circuit Breaker Implementation on Spring Boot
We will create a function with the name fallback, and register it in the @CircuitBreaker annotation. So, when the circuit breaker trips to...
Read more >
A quick guide to Resilience4j with Spring Boot.
It is not applicable when the Circuitbreaker is in HALF_OPEN state. ... to add @CircuitBreaker(name="greetingClientCB") annotation to the method that is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found