Class RetryTemplate

java.lang.Object
org.springframework.core.retry.RetryTemplate
All Implemented Interfaces:
RetryOperations

public class RetryTemplate extends Object implements RetryOperations
A basic implementation of RetryOperations that executes and potentially retries a Retryable operation based on a configured RetryPolicy.

By default, a retryable operation will be retried at most 3 times with a fixed backoff of 1 second.

A RetryListener can be registered to react to events published during key retry phases (before a retry attempt, after a retry attempt, etc.).

All retry actions performed by this template are logged at debug level, using "org.springframework.core.retry.RetryTemplate" as the log category.

Since:
7.0
Author:
Mahmoud Ben Hassine, Sam Brannen, Juergen Hoeller
See Also:
  • Constructor Details

    • RetryTemplate

      public RetryTemplate()
      Create a new RetryTemplate with maximum 3 retry attempts and a fixed backoff of 1 second.
      See Also:
    • RetryTemplate

      public RetryTemplate(RetryPolicy retryPolicy)
      Create a new RetryTemplate with the supplied RetryPolicy.
      Parameters:
      retryPolicy - the retry policy to use
  • Method Details