spring-cloud / spring-cloud-circuitbreaker

Spring Cloud Circuit Breaker API and Implementations
Apache License 2.0
336 stars 110 forks source link

spring native support for @circuitbreaker by resilience4j #159

Closed goafabric closed 1 year ago

goafabric commented 1 year ago

This is a continuation of https://github.com/spring-projects-experimental/spring-native/issues/960

While Resilience4j mostly works fine with native and Spring Boot3, At least when using the programatic "circuitbreaker factory. However leveraging the @CircuitBreaker Annotation does not work in native mode. The adherent CircuitBreakerAspects seemingly never gets invoked. I've attached a sample project below. Starting the application in non native, will trip the circuitbreaker. In Native mode it will do nothing

example.zip

goafabric commented 1 year ago

also see https://github.com/spring-projects/spring-framework/issues/29519 because there might be a correlation

ryanjbaxter commented 1 year ago

The @CircuitBreaker annotation is provided by Resilience4J itself, it is not part of this project. It is something Resilience4J would need to fix.

goafabric commented 1 year ago

https://github.com/spring-projects/spring-framework/issues/29519 will be fixed with boot 3.0.2

now we just need the following

" hints.reflection().registerType(io.github.resilience4j.spring6.circuitbreaker.configure.CircuitBreakerAspect.class, builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_METHODS));"

would be nice if spring-cloud will ship with this out of the box

ryanjbaxter commented 1 year ago

Again this annotation is part of Resilience4J, that project should have the hint