Closed wnederhof closed 2 years ago
I don't see how this is related to spring cloud circuit breaker seems like you are just using vanilla Resilience4J
It should be related to this project because it uses spring-cloud-starter-circuitbreaker-resilience4j
. I also posted this issue in the resilience4j repository, but they mention they don't own this...
https://github.com/resilience4j/resilience4j/issues/1675#issuecomment-1112958958
The annotation @CircuitBreaker
is made available by resilience4j, so I can assume that it may be used by the starter, right?
We don't have any annotation so if the annotation is not working I don't see how it's an issue with out code. If you remove spring cloud circuit breaker and use resilienc4j directly can you reproduce the issue?
Hmm, I simply assumed that the starter would set up resilience4j including the annotations it provides. The fact that it doesn't is a bit surprising for me. There is an official example provided where it does (or at least, should) work. In this case, resilience4j is initialized with the io.github.resilience4j:resilience4j-spring-boot2
starter instead of the spring-cloud-circuitbreaker
variant. Although it uses a different starter, the annotations are provided by the library instead of the starter (and is therefore also included when using the spring-cloud-starter-circuitbreaker-resilience4j
. Therefore it seemed fair to assume that the annotations would also work in this starter.
It turns to work as expected if spring-boot-starter-aop
is provided. Not sure if this starter should then also depend on aop
, so that Resilience4J works with the annotations that are provided? But at least this fixes it for me, so I guess this can be closed. Thank you for thinking along :-)
Spring cloud circuit break should not include the aop dependency because we don't need it. I bet if you added the resilience4j starter it would work.
When I create a brand new Spring Boot project (Spring 2.6.7 with Resilience4J and Spring Web selected), I expect the
@CircuitBreaker
annotation to call a fallback method in case of an exception when applied on a method, but it does not work.pom.xml:
DemoApplication.java:
When running this application and running
curl localhost:8080
, instead of getting "This is what I expect to see.", I'm getting:Am I using
@Resilience4J
in the wrong way, or is there an issue with Resilience4J in combination with Spring Boot 2.6.7?Thank you in advance.