AUTO

Automatically detect the best dispatcher.

When Spring Boot's spring.threads.virtual.enabled=true is set, an org.springframework.core.task.AsyncTaskExecutor backed by virtual threads is available in the application context. In AUTO mode the dispatcher is derived from that executor, so users only need the standard Spring Boot property to opt into virtual threads.

Falls back to kotlinx.coroutines.Dispatchers.IO when no such executor is present.

Warning: When spring.threads.virtual.enabled=false (the default before Spring Boot 3.2), the application task executor is typically a bounded ThreadPoolTaskExecutor (8 core threads by default). Wrapping it as a coroutine dispatcher means all blocking model calls share the same thread pool used by @Async, scheduled tasks, and web MVC async handlers. Under load this can cause thread starvation or deadlocks. In such setups, prefer IO or enable virtual threads.

Properties

Link copied to clipboard
Link copied to clipboard