Companion module for the rewritten post 'Resilience4j Circuit Breaker in Spring Boot 4.1: What It's Still For', reworked around Framework 7 now shipping @Retryable/@ConcurrencyLimit in core. Covers what's still Resilience4j's job (circuit breaker, rate limiter, bulkhead's bounded wait, fallback methods, Actuator/Micrometer metrics), the off-by-one between maxAttempts and maxRetries, and two Boot-4.1 build breaks: spring-boot-starter-aop no longer exists (renamed to spring-boot-starter-aspectj, proven with Maven Central metadata and the renamed starter's own POM -- see resilience/docs/08-starter-aop-renamed-to-starter-aspectj.md in this same repo), and the resulting fix uses that renamed starter directly rather than assembling spring-aop + aspectjweaver by hand. Kept as its own module rather than a new top-level repository, alongside the existing resilience/ module for the sibling Framework-7 post.
2.7 KiB
2.7 KiB
5. Production checklist: which one, for what
Previous: 04-concurrency-limit.md | README
A decision list, built from what chapters 1-4 actually demonstrated rather than from either library's marketing:
- Need a circuit breaker (state that remembers a dependency is down across calls)?
Resilience4j. Nothing in Spring Framework 7 core does this — verified by grepping
spring-context-7.0.9.jarforcircuitbreaker(zero matches). See chapter 1. - Need declarative retry with backoff, and don't already depend on Resilience4j?
@Retryablefrom core is genuinely enough — one annotation, no extra dependency, verified attribute set in chapter 1. Remember it has no fallback and no memory between calls (chapter 3). - Need a rate limiter (calls per second, not concurrent calls)? Resilience4j. There is no rate limiter in Framework 7 core at all.
- Need to cap concurrency, and unlimited blocking for the overflow is acceptable?
@ConcurrencyLimit(policy = BLOCK)— one annotation. - Need to cap concurrency with a bounded wait before giving up? Resilience4j's Bulkhead
with
maxWaitDuration—@ConcurrencyLimithas no equivalent (chapter 4). - Need Actuator health/metrics integration, a dashboard, Micrometer gauges per instance?
Resilience4j —
management.health.circuitbreakers.enabled=trueand theresilience4j_circuitbreaker_*Micrometer series have no equivalent for the core annotations. - Migrating off Resilience4j specifically to cut a dependency? You can drop it only for the retry and simple-throttle cases above. Circuit breaking and rate limiting are not replaced; they're just gone if you remove the dependency.
Gotchas that apply to both, not just one
@EnableResilientMethodsis not auto-configured by Boot 4.1 — add it yourself (chapter 1).spring-boot-starter-aopdoes not exist on Boot 4 — usespring-aopdirectly, and addaspectjweaverexplicitly if you're using Resilience4j's@Aspect-based integration, or the annotations will silently do nothing (chapter 1).- Self-invocation bypasses both, silently, the same way it always has for
@Transactionaland@Async(chapter 3).
Before shipping this repo's app
Nothing here needs removing before production — there's no diagnostic endpoint exposing
internals, just the standard Actuator health/metrics/circuitbreakers set, which is meant
to be exposed (behind auth) in production anyway.