Search code examples
spring-cloud-feignfeign

How to disable Feign's auto retry logic


As it is mentioned in the Feign's documentation, by default, will automatically retry IOExceptions.

We have some another retry logic in our project and I want to prevent Feign's. Is there any easy way to disable it? Or should write my own retryer?

We are using Spring cloud's open feign library.

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

Solution

  • You will need to provide your own Retryer if you wish to change the default retry behavior. It can be applied directly to the Feign.builder or by registering it as a Bean. Either way, you must implement the feign.Retryer interface.