我们如何在同一个方法块中捕获两个不同的异常(例如来自.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)