In Spring Boot, @Async runs a method on a background thread so the caller does not wait for it. Boot auto-configures a thread pool named applicationTaskExecutor for this, so after you add @EnableAsync the annotation works with almost no setup. It is the standard way to push slow, independent work such as email, notifications or remote calls off the request thread.
The method may return void or a CompletableFuture. The call must come from another bean so it goes through the Spring proxy.
Boot detects @EnableAsync, wraps beans that contain @Async methods in a proxy, and sends each proxied call to a task executor. The caller gets control back at once, and the method body runs later on a pool thread. Because the logic lives in the proxy, only calls that cross a bean boundary are asynchronous.
Turn the feature on once, on the main class or any configuration class:
Then mark the method:
The thread name starts with task- by default, which tells you the work really left the calling thread.
Spring Boot registers a ThreadPoolTaskExecutor bean called applicationTaskExecutor when you have not defined your own executor. @Async uses it automatically. You can tune it with properties instead of code:
Two details are worth knowing. The pool grows past its core size only after the queue is full, so a large queue-capacity keeps the pool at core size. And the shutdown settings let in-flight tasks finish when the application stops, which prevents lost work during a deployment.
On Java 21 or later, Spring Boot 3.2+ can use virtual threads instead:
With this property Boot makes the application task executor start a virtual thread per task, and @Async benefits from it. This suits blocking I/O work. It does not make CPU-heavy work faster.
When different jobs need different limits, define named executors and pick one on the annotation:
Heads-up for newer Boot versions: when you define your own Executor bean, Boot's auto-configured applicationTaskExecutor may back off, and @Async methods without a name need a clear default. Naming the executor in the annotation removes any doubt.
The endpoint returns immediately while the pool sends each message. The client cannot learn about failures from this response, so log errors or record the outcome somewhere if delivery matters.
If the caller needs a result, return a CompletableFuture and compose it:
For void methods, exceptions never reach the caller. Implement AsyncConfigurer.getAsyncUncaughtExceptionHandler() to log or report them; otherwise Spring only logs them at error level.
this.sendEmail(...) from the same class skips the proxy and runs synchronously.@EnableAsync. Nothing fails; the method just runs on the caller's thread.No. Boot configures an executor, but you must still add @EnableAsync yourself.
The auto-configured applicationTaskExecutor, a ThreadPoolTaskExecutor, unless you name another executor or enable virtual threads.
Yes, return a CompletableFuture. Returning a plain type gives the caller null.
Print Thread.currentThread().getName(). A name such as task-1 or your own prefix shows it ran on an executor thread.
@Async in Spring Boot sends method calls to the auto-configured applicationTaskExecutor through a proxy. Add @EnableAsync, tune the pool with spring.task.execution.* properties or named executor beans, return CompletableFuture when you need a result, and avoid self-invocation. Virtual threads on Java 21+ are an option for blocking I/O workloads.