I'm trying to add retry logic in my (spring boot gradle plugin) application by adding @Retryable
.
What i have done so far:
Added latest starter aop in class path:
classpath(group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: '1.4.0.RELEASE')
Retry class:
@Component
@EnableRetry
public class TestRetry {
@Retryable(maxAttempts = 3, backoff = @Backoff(delay = 2000))
public void retryMethod() {
throw new RunTimeException("retry exception");
}
}
Test logic:
@Configuration
@EnableRetry
public class CallRetryClass {
public void callRetryMethod() {
TestRetry testRetry = new TestRetry();
testRetry.retryMethod();
}
}
But the retry logic is not working. Do anyone have any suggestion?