DEV Community

Vijay SRJ
Vijay SRJ

Posted on

How to retry API service calls in Spring Boot?

If you ever wanted to retry calling a third party API if it errors out the first time , Spring helps in doing this using
@Retryable annotation . No extra coding required .

Below are the steps:

STEP1 : Add two dependencies to your project (spring-retry and spring-aspects)

STEP2: Add the annotation @EnableRetry in your main class

STEP3: Add the annotation @Retryable on the service method you want to retry .

Explanation here:
https://fullstackdeveloper.guru/2020/09/29/how-to-retry-service-calls-in-spring-boot/

Top comments (0)