Files
spring-boot-demo/resilience/docs/07-migrating-from-spring-retry.md
T
asmhatre 604291067e resilience: prove spring-boot-starter-aop was renamed to spring-boot-starter-aspectj, not removed
Maven Central's maven-metadata.xml for both artifact IDs, read together, shows aop's last
release is 4.0.0-M2 and aspectj's first release is 4.0.0-M3 -- a rename at a milestone
boundary, not a drop. The renamed starter's own published POM depends on exactly
spring-aop + aspectjweaver, the two jars this pom.xml's dependency comment already claimed
were needed; this commit adds the reproducible build-break proof, the metadata/POM evidence,
and a new doc chapter, and backs the corrected companion-repo links from the resilience4j-
circuit-breaker-spring-boot post.
2026-09-18 08:34:06 +00:00

22 lines
1.5 KiB
Markdown

# 7. Migrating from spring-retry
[← 6. What is left for Resilience4j](06-what-is-left-for-resilience4j.md) · [Index](../README.md) · [8. Starter rename: aop → aspectj →](08-starter-aop-renamed-to-starter-aspectj.md)
The spring-retry README now says the project "is no longer maintained as an open-source project"
and "has been superseded by Spring Framework 7". Its last release on Maven Central is 2.0.13.
| spring-retry | Spring Framework 7 | Watch out |
|---|---|---|
| `@EnableRetry` | `@EnableResilientMethods` | |
| `@Retryable(maxAttempts = 3)` | `@Retryable(maxRetries = 2)` | **attempts vs retries** - `maxRetries = 3` is one call more |
| `@Retryable(retryFor = X.class)` | `@Retryable(includes = X.class)` (or `value`) | causes are matched too |
| `@Retryable(noRetryFor = X.class)` | `@Retryable(excludes = X.class)` | |
| `@Backoff(delay, multiplier, maxDelay)` | `delay`, `multiplier`, `maxDelay` attributes | default delay is 1000 ms in both |
| `@Backoff(random = true)` | `jitter` | jitter only adds delay (chapter 3) |
| `@Recover` | none - catch the exception in the caller | declined upstream |
| `RetryTemplate.builder()` | `new RetryTemplate(RetryPolicy.builder()...build())` | `execute` throws `RetryException`; `invoke` throws the original |
| stateful retry / `RetryContext` | none | |
Keep spring-retry on the classpath only as long as something still uses `@Recover` or stateful
retry. Both libraries define an annotation named `Retryable` - check the import on every one.