Spring Boot async tasks
Sets up Spring Boot @Async on bounded executors with a saturation test, so background work behaves under load.
What we improved
Brought the executor configuration, the worker and the caller into SKILL.md as inline code, so the method works without opening the template files. The template and example files are still included. Rewrote the description to say what the s
Improved by YourAISkill from the original by rrezartprebreza, under its MIT licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.
Claude's review
8/10 Accurate Spring Boot @Async guidance on synchronous rejection, default executor resolution, capacity math, context restore and a deterministic saturation test through the real proxy.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Use when adding or debugging Spring @Async work, executor saturation, asynchronous failures or lost thread context. Not a substitute for durable jobs or reactive pipelines.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: async-execution
description: >
Add, review or debug Spring Boot 3 @Async work: a bounded, named ThreadPoolTaskExecutor,
proxy self-invocation, CompletableFuture failure handling, synchronous TaskRejectedException,
which executor an unqualified @Async really uses, transaction and after-commit boundaries,
MDC, tenant and security context propagation, virtual threads, and tests that go through the
real proxy. Use when code adds @Async or @EnableAsync, an executor saturates or silently drops
work, async failures vanish, or thread context leaks between requests. Not a substitute for
durable jobs (keep the project's broker or job framework) or for reactive pipelines.
---
<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by rrezartprebreza. See CHANGES.md. -->
# Async Execution
## Spring Boot 3 baseline
Use Framework 6 APIs and the project's Boot BOM. The shipped examples compile on Java 17.
Boot 3.2+ can opt into virtual threads on Java 21; do not assume this on earlier Boot 3 releases.
Check the exact minor before copying newer task-execution properties.
## 1. Choose the execution boundary
First decide whether losing work on process exit is acceptable. In-memory async work is not
a durable queue: a deploy, crash or full queue loses it. Required notifications, payments and
accepted background jobs need persisted intent plus recovery (an outbox row, a job table, a
broker message), not just an AFTER_COMMIT listener or an HTTP 202 response.
Keep an existing broker or job framework when it already owns this contract.
| The work is... | Use |
|---|---|
| Nice to have, safe to lose (cache warm-up, best-effort metrics) | @Async on a bounded executor |
| Must happen once the request is accepted | Persist the intent in the same transaction, then process it from a job runner or broker |
| A pipeline of non-blocking I/O already on Reactor | Stay reactive; do not wrap it in @Async |
## 2. The minimal correct shape
Enable async interception once, give the work its own bounded executor, put the @Async method
on a separate Spring bean, and return CompletableFuture when the caller must observe failure.
...From rrezartprebreza's repository, MIT licence.
Related skills
-
Checked
Hibernate and JPA fixes
Finds and fixes Hibernate and JPA problems like N+1 queries and lazy loading errors, so your Java app stays fast.
8/101 credit -
Checked
Spring Boot event tests
Shows how to test Spring event publishers and listeners, async and after commit too, so tests catch real bugs.
8/101 credit -
Checked
Kotlin JPA entities
Models JPA entities in Kotlin with correct equality, fetching and relations, so you avoid N+1 and lazy errors.
7/101 credit -
Checked
Java Debugging Guide
Finds the cause of Java bugs and failing tests, and attaches a debugger safely in Maven, Gradle, Spring or Docker.
7/101 credit -
Checked
JUnit and Mockito tests
Writes and fixes Java tests with JUnit, AssertJ and Mockito that are deterministic and keep failures visible.
8/101 credit -
Checked
Modern Java Coding
Writes and reviews modern Java 21 and 25 code with records, sealed types, pattern matching and virtual threads.
7/101 credit