2
我试图通过添加@Retryable
在我的(spring boot gradle插件)应用程序中添加重试逻辑。@Retryable在Spring-boot-gradle-plugin上不起作用
是我迄今所做的:
增加了最新的入门AOP在类路径:
classpath(group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: '1.4.0.RELEASE')
重试类:
@Component
@EnableRetry
public class TestRetry {
@Retryable(maxAttempts = 3, backoff = @Backoff(delay = 2000))
public void retryMethod() {
throw new RunTimeException("retry exception");
}
}
测试逻辑:
@Configuration
@EnableRetry
public class CallRetryClass {
public void callRetryMethod() {
TestRetry testRetry = new TestRetry();
testRetry.retryMethod();
}
}
但是重试逻辑不起作用。有没有人有任何建议?