I\'ve Develop a retry mechanism by taking a reference from the following course. Below is the code I developed in Spring Batch, in this code @Recover
method is
You are using the retryTemplate
in a programmatic way, so you need to provide the RecoveryCallback
as a second parameter:
retryTemplate.execute(new MyRetryCallback(), new MyRecoveryCallback());
If you want to use the declarative approach using annotations, you need to annotate the retryable method with @Retryable
and the recovery method with @Recover
.
You can find an example of each approach in the home page: https://github.com/spring-projects/spring-retry#quick-start