小编Med*_*Med的帖子

Spring Retry - 异常问题和重试

我们如何在同一个方法块中捕获两个不同的异常(例如来自.lang和包) 。其一,我们返回一个,另一个我们重试该方法。.io@RetryableIOException

@Retryable(value = {Exception.calss } ,maxAttempts = 3, backoff = @Backoff(delay = 3000))
public String getInfo() {
    try {
        //here we have an executive code that may have an IOException
    } catch(Exception ex) {
        //And here i would catch the Exception 
        throw new Exception();
    }   
}
Run Code Online (Sandbox Code Playgroud)

java spring exception spring-retry spring-boot

4
推荐指数
1
解决办法
4546
查看次数

标签 统计

exception ×1

java ×1

spring ×1

spring-boot ×1

spring-retry ×1