The following code is not retrying. What am I missing?
@EnableRetry
@SpringBootApplication
public class App implements CommandLineRunner
{
.........
....
It work for return type as well
@Service
public class RetryService {
private int count = 0;
// try the method 9 times with 2 seconds delay.
@Retryable(maxAttempts = 9, value = Exception.class, backoff = @Backoff(delay = 2000))
public String springReTryTest() throws Exception {
count++;
System.out.println("try!");
if (count < 4)
throw new Exception();
else
return "bla";
}
}