Spring Boot and concurrency in Kotlin
Coroutines vs Reactor vs virtual threads for Spring Boot in Kotlin: which to pick, plus validating input and carrying per-request context.
Start with
-
Coroutines vs Reactor vs Virtual Threads in Kotlin
Coroutines vs Reactor vs virtual threads for Kotlin on Spring: how each model works, what it costs in debugging and tracing, and which one to pick first.
-
Validating HTTP Arguments Safely in Kotlin
Validate HTTP arguments in a Kotlin Spring controller without binding errors: string inputs with defaults, Bean Validation, then a domain type.
For a new Kotlin service on Spring, my default is Spring MVC on virtual threads and Java 25, with coroutines only where a request fans out to several services. Reactor is still the best tool for streaming with backpressure, and a WebFlux service that works doesn’t need a rewrite.
Choosing a concurrency model Link to heading
A Kotlin team on Spring now has three credible ways to keep threads from sitting idle while they wait on I/O: Project Reactor, Kotlin coroutines, and JVM virtual threads. Coroutines vs Reactor vs Virtual Threads in Kotlin compares how each one works, what it costs in debugging and tracing, and which to pick first.
If you’re already on WebFlux, Project Reactor and Why Kotlin Is the Perfect Fit introduces Mono and Flux with the Kotlin extensions, and Waiting Without Blocking in Reactor shows a small pattern for waiting on a condition with delayUntil and Mono.defer.
Handling the request Link to heading
- Validating HTTP arguments safely in Kotlin: string inputs with defaults, then Bean Validation, then a domain type, so bad input never becomes a binding error.
- Kotlin context parameters in Spring: carry one per-request snapshot through the call chain, and where constructor injection is still the right tool.
- Memoization with Lombok lazy getters, in Java: compute a value once per request with a request-scoped bean, without a cache.
For the language side of Kotlin on the backend, see Kotlin for Java developers.
All posts in this topic
-
Kotlin Context Parameters in Spring: A Practical Guide
Kotlin 2.4.0 made context parameters stable. Here’s how I’d use them in a Spring service to carry one per-request snapshot through the call chain — and where constructor injection is still the right tool.
-
Coroutines vs Reactor vs Virtual Threads in Kotlin
Kotlin on Spring now has three credible ways to handle I/O-heavy work. Here’s how Reactor, coroutines, and virtual threads compare, what each one costs, and how I’d choose.
-
Memoization with Lombok Lazy Getters in Spring
Use Lombok’s lazy getter with a request-scoped bean to compute a value once per request without a cache.
-
Waiting Without Blocking in Reactor (delayUntil)
A simple Reactor pattern for waiting on a condition without blocking threads, using delayUntil and Mono.defer for a safe, lazy check.
-
Validating HTTP Arguments Safely in Kotlin
Strong types are great—until they crash your controller. This article shows how to validate HTTP arguments safely using Kotlin defaults, bean validation, and centralized conversion to avoid runtime errors and keep your code clean.
-
Project Reactor and Why Kotlin Is the Perfect Fit
Reactive programming is powerful—but often verbose and clunky in traditional languages. Kotlin, with its extension functions, lambda-friendly syntax, and unchecked exceptions, makes Project Reactor a joy to use.