Files
spring-boot-demo/resilience/docs/02-enabling.md
T
asmhatreandClaude Opus 5 7e1676c763 Add resilience: Spring Framework 7 @Retryable and @ConcurrencyLimit
Companion code for "Spring Framework 7's Built-in Resilience: @Retryable,
@ConcurrencyLimit, and What's Left for Resilience4j". Every retry counted
by recording real invocations: defaults, backoff and jitter, timeout,
reactive and CompletableFuture returns, the concurrency limit's BLOCK and
REJECT policies, retries around transactions, composition with
Resilience4j 2.4.0, and the annotation API across 7.0.0-7.0.9.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
2026-09-11 17:12:25 +00:00

1.5 KiB

2. Switching it on - and the three ways it stays off

← 1. What ships · Index · Next: 3. @Retryable measured →

Spring Boot 4.1.1 does not enable it

No auto-configuration in Boot 4.1.1 registers RetryAnnotationBeanPostProcessor or ConcurrencyLimitBeanPostProcessor (no Boot 4.1.1 jar in this project's dependency tree mentions either class). You need @EnableResilientMethods.

Without it the annotations are metadata. retry-disabled.txt, same method, demo.resilience.enabled=false:

"invocations": 1,
"caller": "threw: com.ankurm.resilience.support.TransientException: attempt 1 failed"

No warning at startup, no log line at call time.

Self-invocation

A call from inside the bean does not go through the proxy (retry-self-invocation.txt): one invocation, first exception straight to the caller. Same rule as @Transactional and @Async - see the AOP article.

final methods

The proxies here are CGLIB subclasses (/demo/proxy/* reports the type - the demo beans implement no interface). A subclass cannot override a final method, so a final @Retryable method is called directly on the target and never retried - the same silent failure measured for @Async in the @Async article.