I found a problem when doing spring-retry with spring boot. When a class implements an interface, it cannot enter the @recover method after exceeding the maximum number of retries. But when I inject a normal class, I can enter this method.Your prompt help and kind advices would be much appreciated,thanks!
When I do this,I can enter the @Recover method
@Service
public class TestService {
@Retryable(Exception.class)
public String retry(String c) throws Exception{
throw new Exception();
}
@Recover
public String recover(Exception e,String c) throws Exception{
System.out.println("got error");
return null;
}
}
But once the class implement another interface, it's not works
@Service
public class TestService implements TestServiceI{
@Override
@Retryable(Exception.class)
public String retry(String c) throws Exception{
throw new Exception();
}
@Recover
public String recover(Exception e,String c) throws Exception{
System.out.println("got error");
return null;
}
}