@Retryable场景:--我需要在运行时修改的maxAttempts值,以便可以从数据库中驱动重试次数。class PropertyHolder { public int retryCount() { return retryCount; } @Scheduled= 0; //Fetch retryCount from DB and update retryCount}
public class SimpleService{
@R
根据文档,我可以在exceptionExpression:@Retryable(exceptionExpression="message.contains('this can be retried')"编辑:使用Gary的建议添加整个@Retryable注释参数:
@Retryable(value = HttpClientErrorException.class, exceptionExpressionAND responseBodyAsString.contains('important
我使用Spring的调度器(@EnableScheduling),并使用下面的@Scheduled方法,它每分钟都会被调用一次:public class ScheduledTask{
public void run() {我可以注入ScheduledTask,只需调用run方法。但是,我希望确保在任何给定时间只有一个线程运行run方法