You can add a Retryer in the FeignClientConfig

@Configuration
public class FeignClientConfig {

    @Bean
    public Retryer retryer() {
        return new Custom();
    }

}

class Custom implements Retryer {

    private final int maxAttempts;
    private final long backoff;
    int attempt;

    public Custom() {
        this(2000, 3);
    }

    public Custom(long backoff, int maxAttempts) {
        this.backoff = backoff;
        this.maxAttempts = maxAttempts;
        this.attempt = 1;
    }

    public void continueOrPropagate(RetryableException e) {
        if (attempt++ >= maxAttempts) {
            throw e;
        }

        try {
            Thread.sleep(backoff);
        } catch (InterruptedException ignored) {
            Thread.currentThread().interrupt();
        }
    }

    @Override
    public Retryer clone() {
        return new Custom(backoff, maxAttempts);
    }
}

Updated with sample Retryer example config based on the Retryer.Default.

Answer from Jeff on Stack Overflow
🌐
GitHub
github.com › OpenFeign › feign › blob › master › core › src › main › java › feign › Retryer.java
feign/core/src/main/java/feign/Retryer.java at master · OpenFeign/feign
* Cloned for each invocation to {@link Client#execute(Request, feign.Request.Options)}. * Implementations may keep state to determine if retry operations should continue or not. */ public interface Retryer extends Cloneable { · /** * if retry is permitted, return (possibly after sleeping).
Author: OpenFeign
🌐
Baeldung
baeldung.com › home › rest › retrying feign calls
Retrying Feign Calls | Baeldung
February 3, 2022 - Fortunately, retrying abilities are baked in Feign, and they just need to be configured. We can do that by providing an implementation of the Retryer interface to the client builder.
🌐
Medium
mohewedy.medium.com › how-to-enable-retry-for-some-methods-in-openfeign-4e02d05a81fd
How to enable retry for selected methods in OpenFeign | by Mohammed Hewedy | Medium
June 10, 2023 - So to control which methods are retriable and which are not, I’ve created one annotation `FeignRetryable`. ... It works simply by accepting a delegate `Retryer` and applying it when the method is annotated by this annotation.
🌐
Springcloud
springcloud.io › post › 2022-01 › spring-cloud-openfeign-timeout-and-retry
Spring Cloud OpenFeign timeout and retry - Spring Cloud
January 11, 2022 - Implement the feign.Retryer interface · Understanding of the three parameters. period: period, retry interval time · maxPeriod: maximum period, the retry interval time gradually increases according to certain rules, but cannot exceed the maximum period · maxAttempts: the maximum number of attempts, the number of retries ·
🌐
Medium
xialeistudio.medium.com › how-to-retry-requests-correctly-with-feign-bf7056b03403
How to retry requests correctly with Feign | by Xia Lei | Medium
May 5, 2023 - We can implement ErrorDecoder to return a RetryableException so Feign will retry our request, and we need implement a Retryer, modify the request parameters in continueOrPropagate method.
🌐
SeedStack
seedstack.org › addons › feign
Feign
With feign, you can define a retryer having the role to determine if a request should be retryed or not, letting you decide of the retry policy you want to apply to your endpoint ( See https://github.com/OpenFeign/feign#retry ). This feature ...
🌐
Javadoc.io
javadoc.io › doc › io.github.openfeign › feign-core › 9.2.0 › feign › Retryer.html
Retryer - feign-core 9.2.0 javadoc
Latest version of io.github.openfeign:feign-core · https://javadoc.io/doc/io.github.openfeign/feign-core · Current version 9.2.0 · https://javadoc.io/doc/io.github.openfeign/feign-core/9.2.0 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/io.github.openfeign/feign-core/9.2.0/package-list ·
Find elsewhere
🌐
Medium
medium.com › swlh › how-to-customize-feigns-retry-mechanism-b472202be331
How to Customize Feign’s Retry Mechanism | by Ruhshan Ahmed Abir | The Startup | Medium
July 15, 2024 - Thus retry is not enabled in feign out of the box. Unfortunately this never happens, for a tcp packet there are a millions ways to die in the web. So to enable retry, you have to put the following bean in your client configuration.
🌐
Tech Me More
diehardtechy.com › 2020 › 05 › openfeign-retry-request-based-on-custom.html
OpenFeign : retry request based on custom HTTP response status - Tech Me More
*/ public FeignRetyer() { this(10000, 5); } public FeignRetyer(long backoff, int maxAttempts) { this.backoff = backoff; this.maxAttempts = maxAttempts; this.attempt = 1; } public void continueOrPropagate(RetryableException e) { if (attempt++ >= maxAttempts) { throw e; } try { TimeUnit.MILLISECONDS.sleep(backoff); } catch (InterruptedException ex) { } log.info("Retrying: " + e.request().url() + " attempt " + attempt); } @Override public Retryer clone() { return new FeignRetyer(backoff, maxAttempts); } } In the above example, we are retrying 5 times before throwing the exception and the interval between the request is 10 seconds.
🌐
Javadoc.io
javadoc.io › doc › io.github.openfeign › feign-core › 10.7.0 › feign › Retryer.html
Retryer - feign-core 10.7.0 javadoc
Latest version of io.github.openfeign:feign-core · https://javadoc.io/doc/io.github.openfeign/feign-core · Current version 10.7.0 · https://javadoc.io/doc/io.github.openfeign/feign-core/10.7.0 · package-list path (used for javadoc generation -link option) https://javadoc.io/doc/io.github.openfeign/feign-core/10.7.0/package-list ·
🌐
DEV Community
dev.to › sabyasachi › spring-feign-client-3853
Spring Feign Client - DEV Community
August 28, 2022 - public class CustomRetryer extends Retryer.Default{ public CustomRetryer(long period, long maxPeriod, int maxAttempts){ super(period, maxPeriod, maxAttempts); } @Override public void continueOrPropagate(RetryableException e){ log.info("Going to retry for ", e); super.continueOrPropagate(e); } @Override public Retryer clone(){ return new CustomRetryer(5,SECONDS.toMillis(1), 5); } } One important fact is feign Retry works either on IOException or RetryableException thrown from some errorDecoder .
🌐
Wordpress
buddhimawijeweera.wordpress.com › 2020 › 01 › 29 › error-decoding-and-retrying-with-feign-clients
Error Decoding and Retrying with Feign Clients – BUDDHIMA'S COMPUTER LAB
February 1, 2020 - You can configure default retryer with parameters by extending Retryer.Default class. ... package com.buddhima.testing.demo.client; import feign.Retryer; public class DrmClientRetryer extends Retryer.Default { public DrmClientRetryer() { super(); } }
🌐
Spring
docs.spring.io › spring-cloud-openfeign › docs › current › reference › html
Spring Cloud OpenFeign
Spring Cloud OpenFeign does not provide the following beans by default for feign, but still looks up beans of these types from the application context to create the feign client: ... A bean of Retryer.NEVER_RETRY with the type Retryer is created by default, which will disable retrying.
🌐
Javadoc.io
javadoc.io › static › io.github.openfeign › feign-core › 10.7.0 › feign › Retryer.html
Retryer (Feign Core 10.7.0 API)
feign · All Superinterfaces: Cloneable · All Known Implementing Classes: Retryer.Default · public interface Retryer extends Cloneable · Cloned for each invocation to Client.execute(Request, feign.Request.Options). Implementations may keep state to determine if retry operations should continue or not.
🌐
GitHub
github.com › OpenFeign › feign › issues › 1966
Feign retries event if Retryer.NEVER_RETRY is configured in the AsyncFeign.<HttpClientContext>builder() · Issue #1966 · OpenFeign/feign
March 1, 2023 - import static feign.Retryer.NEVER_RETRY; @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public AsyncFeign.AsyncBuilder<HttpClientContext> defaultAsyncBuilder(AsyncClient<HttpClientContext> httpClient, Decoder decoder, Encoder encoder, Contract contract, ErrorDecoder errorDecoder, GlobalFeignRequestInterceptor globalFeignRequestInterceptor) { return AsyncFeign.<HttpClientContext>builder() .client(httpClient) .decoder(decoder) .errorDecoder(errorDecoder) .encoder(encoder) .dismiss404() .retryer(NEVER_RETRY) // Disable Feign retries .contract(contract) .requestInterceptor(globalFeignRequestInterceptor); }
Author: OpenFeign
🌐
Matez
matez.de › index.php › 2017 › 04 › 12 › exploring-feign-retrying
Exploring Feign – Retrying - matez blog
April 12, 2017 - What most developers don’t know, Feign has a default retryer built-in.
🌐
GitConnected
levelup.gitconnected.com › feign-client-retry-and-timeout-configurations-214eaf14a4d1
Feign Client Retry and Timeout configurations | by Ivan Polovyi | Level Up Coding
April 4, 2025 - The Feign client has two configurations that can handle erroneous responses by retrying and giving up on requests that take too long. We…
🌐
DZone
dzone.com › software design and architecture › microservices › configurable feign client retry with reusable library and dry
Configurable Feign Client Retry With Reusable Library, DRY
December 4, 2024 - Learn how to implement and expose common retry features for Feign clients through application configuration, using the Spring Cloud Framework efficiently.