Spring / Spring Retry Interview Questions
What are transient vs permanent failures and why does the distinction matter for retry?
Correctly classifying failures as transient or permanent is the foundation of any effective retry strategy. Retrying permanent failures wastes resources and delays the surfacing of bugs; failing to retry transient failures reduces system resilience unnecessarily.
Transient failures are temporary, self-healing conditions where the same operation, retried after a brief delay, has a realistic chance of succeeding:
- Network timeouts and connection resets
- Service temporarily unavailable (HTTP 503)
- Database deadlocks or lock timeouts
- Throttling responses (HTTP 429)
- Brief cloud resource contention
Permanent failures are errors where retrying the identical request will always produce the same result:
- Invalid request (HTTP 400 Bad Request)
- Unauthorized (HTTP 401) — credentials won't change between retries
- Resource not found (HTTP 404) — the resource won't appear on retry
- Data validation constraint violations
- Programming errors like NullPointerException
In Spring Retry, you encode this distinction through retryFor and noRetryFor:
@Retryable(
retryFor = { SocketTimeoutException.class, HttpServerErrorException.class },
noRetryFor = { HttpClientErrorException.class, IllegalArgumentException.class }
)A well-designed retry policy only activates on exceptions that signal transient conditions, leaving permanent errors to surface immediately.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
