Every @Async behaviour that surprises people, asserted by a test and captured to docs/output/: the self-invocation trap, what CGLIB cannot override, the IllegalArgumentException a plain return type throws, the unbounded queue that makes max-size decoration, spring.task.execution.propagate-context (new in Boot 4.1.0), the two Executor beans that leave @Async on an unpooled SimpleAsyncTaskExecutor, and JEP 491 measured on JDK 21 against JDK 25.
1.3 KiB
spring-async-demo
Companion code for the asynchronous execution series on ankurm.com. Each
directory is a self-contained Maven project for one article, with its own pom.xml, its own
numbered documentation chapters, and its own captured output under docs/output/ — regenerated
by that module's scripts/run-all.sh, never typed by hand.
| Module | Article | What it demonstrates |
|---|---|---|
async/ |
@Async in Spring Boot 4: Executors, Virtual Threads and the Self-Invocation Trap | Which thread a method actually ran on, in every case where the answer is not the one you expect |
Common ground
All modules target the same verified stack: JDK 25 (Temurin 25.0.4.1+1), Spring Boot
4.1.1, Spring Framework 7.0.9. Versions were read from maven-metadata.xml on Maven Central
and from Boot's own spring-boot-dependencies POM, rather than from release announcements.
Everything is asserted by a test and captured to a file. The measurement is nearly always the same
one: the name of the thread that ran the work, returned by the code itself. Timing cannot tell a
fast synchronous call from an asynchronous one, which is why @Async failures survive so long in
production.
Licence
MIT — see LICENSE.