Scrivio Interview library
ScenarioFoundations6 min read · updated 12 November 2026

Your team wants to adopt Kotlin coroutines in a Java Spring Boot service. As a senior developer, how would you evaluate the proposal?

I would first ask what problem coroutines solve that our current tools, modern Java, virtual threads or Reactor, do not. Then I would look at the people cost of mixing two languages (skills, hiring and code review), check tooling, build and library support in our stack, including Spring's coroutine support, and propose a small, low-risk trial with clear success criteria. Whatever we decide, we record it in an ADR together with how we would reverse it.

Why this question is asked

Kotlin coroutines are a well-designed way to write asynchronous code that reads like ordinary sequential code, and Spring supports them. So the proposal is reasonable, and a senior developer should neither reject it out of habit nor accept it because it is exciting. Interviewers ask this to see how we evaluate a technology proposal in a structured way. In this answer, we will recap coroutines and the alternatives, define the problem, weigh the people cost, check tooling, design a trial and record the decision.

1A Quick Recap: Coroutines and the Alternatives

A coroutine is a function that can suspend, pausing while it waits for something such as a network response, without blocking the thread it runs on. In Kotlin, such functions are marked suspend, and the compiler turns them into state machines that resume when the result arrives. The code still reads top to bottom, which is a big improvement over callback chains. Spring Framework supports suspend functions in WebFlux controllers and Kotlin Flow for streams.

Our Java service already has two ways to get similar benefits. Virtual threads, final since Java 21, are lightweight threads managed by the JVM: blocking code on a virtual thread releases the underlying carrier thread while it waits, so we can run tens of thousands of concurrent blocking requests with ordinary code. In Spring Boot 3.2 and later, spring.threads.virtual.enabled=true turns them on for request handling. And Project Reactor, used by WebFlux, gives non-blocking streams with back-pressure, at the cost of a more complex programming style.

Java
// Kotlin coroutine // Java on a virtual thread
suspend fun quote(id: String): Quote { Quote quote(String id) {
val p = pricing.price(id) // suspends var p = pricing.price(id); // blocks the virtual thread only
val s = stock.level(id) // suspends var s = stock.level(id);
return Quote(p, s) return new Quote(p, s);
} }

Notice how similar the two look. For simple request handling, virtual threads give much of what coroutines give, without a second language.

2What Problem Would Coroutines Solve?

The first question is always the problem, not the tool. Is the service suffering from thread exhaustion under load? Virtual threads may fix that with a configuration change. Do we need structured concurrency, running several calls in parallel and cancelling all of them if one fails? Kotlin's coroutineScope does that well; Java's structured concurrency API has been in preview over several recent releases, so check its status in Java 25 before relying on it. Do we already use WebFlux and find Reactor chains hard to read? Then coroutines on top of WebFlux are a strong option, and this is where they shine most clearly.

If the honest answer is 'the team finds Kotlin nicer', that is a real but weaker reason, and it should be weighed against the costs below rather than presented as a technical need.

Matching the problem to a tool
ProblemStrong optionNotes
Thread exhaustion with blocking I/Ovirtual threadsone property in Spring Boot 3.2+
Hard-to-read Reactor chains in WebFluxKotlin coroutinessuspend functions in controllers
Parallel calls with cancellationcoroutines, or Java structured concurrencycheck the Java API's status
Streaming with back-pressureReactor or Kotlin Flowboth supported by Spring
If the problem sits in the first row, coroutines are probably not needed.

3The People Cost of Mixing Languages

A Java service with some Kotlin is a two-language service. Every reviewer must be comfortable reading Kotlin, including coroutine details such as dispatchers, cancellation and which code may block. New hires need both skills, or a ramp-up period. On-call engineers debugging at night meet stack traces through coroutine machinery. If only two of eight team members know Kotlin well, they become a bottleneck for reviews and incidents.

This cost is lower if the wider company already uses Kotlin, if many team members want to learn it, or if the service is likely to move entirely to Kotlin over time. It is higher in a company where every other service is Java.

4Tooling, Build and Library Support

Kotlin on the JVM is mature: Gradle and Maven support it, IntelliJ IDEA is excellent with it, and Spring Boot generates Kotlin projects. But we should check our specific stack. The Kotlin compiler plugin for Spring (kotlin-spring, which opens classes for proxies) and the JPA plugin (for no-argument constructors) must be configured. Static analysis, code coverage and security scanning tools must support Kotlin in our pipeline. Our libraries matter too: if the service uses JDBC and JPA, which block, coroutines do not make them non-blocking; we would need R2DBC or run blocking calls on an appropriate dispatcher.

That last point is easy to miss. Coroutines bring their benefit only when the code underneath can suspend. With a blocking database driver, we pay the language cost for little gain.

5A Small Trial With Clear Success Criteria

If the problem fits, we propose a trial in a small, low-risk part of the service, for example a read-only endpoint that aggregates three downstream calls in parallel. Before starting, we write the success criteria: perhaps p95 latency improves by 30 percent compared with the sequential Java version, the code is shorter and two reviewers who do not know Kotlin find it readable, the build and scanning pipeline needs no special work, and no production incidents in four weeks. We also compare against the simplest alternative, the same endpoint on virtual threads with parallel calls, so we measure the benefit of coroutines specifically.

Step throughEvaluating the coroutine proposal
  1. State the problem in measurable termslatency, threads, readability
  2. Do existing Java tools solve it?
    YesUse virtual threads or Reactor; stop hereNoContinue the evaluation
  3. Check skills, tooling and library supportblocking drivers, plugins, scanners
  4. Trial on one low-risk endpointcompare with a virtual-thread version
  5. Criteria met?
    YesAdopt within agreed scope, record ADRNoRemove the trial code, record why

5 steps in order. Play them, or step through them one at a time.

6Recording the Decision and How to Reverse It

Whatever the outcome, we write a short ADR: the problem, the options including virtual threads, the trial results, the decision and the scope, for example 'Kotlin coroutines allowed in the aggregation module only'. We also write how to reverse it: because Kotlin and Java interoperate, the Kotlin classes can be rewritten in Java one at a time, and keeping Kotlin limited to well-defined modules keeps that cost small. Knowing that a decision can be undone makes it easier for a sceptical team to agree to the trial.

7Follow-up questions

Do coroutines and virtual threads compete or combine?

They can combine: coroutines can run on a dispatcher backed by virtual threads. But for a Java service, virtual threads alone often solve the concurrency problem, so the question is whether the extra benefits of coroutines, such as structured concurrency and Flow, are worth a second language.

What is a common mistake when introducing coroutines in Spring?

Calling blocking code, such as JDBC or a blocking HTTP client, from a coroutine on a dispatcher meant for non-blocking work. It blocks the shared threads and can stall the service. Blocking calls must use Dispatchers.IO or be replaced with non-blocking clients.

Would you allow Kotlin in new services only?

That is often a cleaner boundary than mixing languages inside one codebase. A new service fully in Kotlin has one language, clear ownership and no mixed reviews. It still needs the company to accept a second language in its platform, which is a wider decision.

8Conclusion

In this answer, we saw how to evaluate a proposal to adopt Kotlin coroutines in a Java Spring Boot service: define the problem and check whether virtual threads or Reactor already solve it, weigh the skills, hiring and review cost of a second language, check tooling, build and library support including blocking drivers, run a small trial with clear criteria compared against the simplest alternative, and record the decision with its scope and how to reverse it.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start with the problem rather than the tool. Coroutines let us write non-blocking code that reads sequentially, but on Java 21 and later, virtual threads give us a lot of that with plain blocking code and one property in Spring Boot, so if the problem is thread exhaustion, we may not need Kotlin at all.

Then, if they want more

Where coroutines really shine is replacing hard-to-read Reactor chains in WebFlux, or structured concurrency, running calls in parallel with proper cancellation. Then I would look at the people side: a Java service with Kotlin means every reviewer and on-call engineer needs Kotlin and coroutine knowledge, and if only two of eight people have it, they become a bottleneck.

I would check tooling: the Kotlin Spring and JPA compiler plugins, our static analysis and security scanners, and especially our libraries, because with blocking JDBC the coroutines bring little.

If it still looks promising, I would trial it on one low-risk endpoint, with criteria written beforehand, like latency, readability for non-Kotlin reviewers and no pipeline issues, and compare it with a virtual-thread version of the same endpoint. Finally an ADR with the decision, the scope and how to reverse it, which is easy because Kotlin and Java interoperate.

About this answer

Last updated
12 November 2026
Versions it names
Java 21, Java 25, Spring Boot 3.2
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your team wants to adopt Kotlin coroutines in a Java Spring Boot service. As a senior...": https://scrivio-interview-library.netlify.app/architecture/architecture-decisions/69bb31fb4d/