spring-cloud-openfeign
spring-cloud-openfeign copied to clipboard
No CircuitBreakerNameResolver set in circuitBreakerFeignBuilder Bean
We are trying to use Feign with Resilience4j, but without the @EnableFeignClients annotation.
When trying to use the circuitBreakerFeignBuilder Bean created in https://github.com/spring-cloud/spring-cloud-openfeign/blob/c53d5565cb5d5c32e73a1b07bf835441a4c51132/spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientsConfiguration.java#L232 to create Feign clients (via the target method), the following exception is thrown:
java.lang.NullPointerException: Cannot invoke "org.springframework.cloud.openfeign.CircuitBreakerNameResolver.resolveCircuitBreakerName(String, feign.Target, java.lang.reflect.Method)" because "this.circuitBreakerNameResolver" is null
at org.springframework.cloud.openfeign.FeignCircuitBreakerInvocationHandler.invoke(FeignCircuitBreakerInvocationHandler.java:98)
...
Unfortunately, the four FeignCircuitBreaker.Builder methods circuitBreakerFactory, feignClientName, circuitBreakerGroupEnabled and circuitBreakerNameResolver are not public, therefore it is not possible to set the circuitBreakerNameResolver (without reflection).
It would be nice having either a working circuitBreakerFeignBuilder bean or to be able to set the properties manually.