Did a method just throw an Exception? Well, we could re-invoke it a few times more before giving up using Spring’s Retry API. Last time we touched on BackOff and related interfaces and classes which is used in this API.
Spring-Retry allows for the re-execution of operations when an Exception is thrown. How do we limit the retries to specific exceptions only? For instance, we wouldn’t want to retry a SOAP Web Service operations (@WebMethod) that threw exceptions due to invalid values or internal errors on the remote services. However, we would want to retry those failed operations caused by connectivity or unavailability issues, e.g., no Internet connection, and “server is busy”.