Quick revision
The short answer
Nothing is sent because Reactor is lazy: webClient.get()...bodyToMono(Dto.class) only describes a request, and the request is made when something subscribes to the Mono. If the Mono is neither returned to a framework that subscribes to it, as WebFlux does, nor subscribed or blocked on in our code, it is simply discarded. In a blocking Spring MVC service, calling block() on request threads is acceptable, never on event-loop threads, and if the whole service is blocking, RestClient is the simpler client.
What to remember
In this answer, we saw that the WebClient call sent nothing because Reactor is lazy: retrieve() and bodyToMono() only describe the request, and it runs when a subscriber subscribes. If the Mono is not returned to WebFlux or a Spring MVC controller, and not subscribed or blocked on, it is simply discarded. block() is acceptable on MVC request threads, with a timeout, but throws on event-loop threads, and a fully blocking service is better served by RestClient, which executes the request directly.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Nothing is sent because Reactor is lazy: webClient.get()...bodyToMono(Dto.class) only describes a request, and the request is made when something subscribes to the Mono. If the Mono is neither returned to a framework that subscribes to it, as WebFlux does, nor subscribed or blocked on in our code, it is simply discarded. In a blocking Spring MVC service, calling block() on request threads is acceptable, never on event-loop threads, and if the whole service is blocking, RestClient is the simpler client.
Why this question is asked
This bug surprises almost everyone who first uses WebClient from a classic Spring MVC application. The code compiles, no exception is thrown, logs show the line was executed, and the downstream service never receives a request. Interviewers ask it because it tests whether we understand the most basic rule of reactive programming, that building a pipeline and running it are two different things. In this answer, we will reproduce the bug, explain laziness in Reactor, see the three ways to make the request happen, look at why block() is fine in MVC but forbidden on event loops, and consider whether WebClient is the right client here at all.
1Reproducing the Problem
Here is the kind of code that shows the bug. A service method wants to notify another service and moves on.
Notice that both log lines print, so it looks as if the call happened. The method created a Mono, a description of a future HTTP call, and then ignored the return value. Nothing ever asked that Mono to run.
2Why Reactor Does Nothing Until Subscription
In Reactor, Mono and Flux are recipes, not results. Each operator, such as retrieve() or bodyToMono(), adds a step to the recipe and returns a new Mono. No work happens while the recipe is being written. The work starts only when a subscriber subscribes, and it starts again for each new subscriber, which is what lets the same Mono be retried or reused.
This is the opposite of a CompletableFuture, which starts running as soon as it is created. With WebClient, subscription is the moment the connection is taken from the pool and the request is written. So a Mono that nobody subscribes to never touches the network, and a Mono that is subscribed twice sends two requests.
- webClient.post().uri(...).retrieve()builds a description, sends nothing
- bodyToMono(Void.class)still only a description
- Does anything subscribe to the Mono?YesThe request is sent, the response is decodedNoThe Mono is discarded and nothing happens
- Subscriber gets the resultor an error signal
4 steps in order. Play them, or step through them one at a time.
3Three Ways to Make the Request Happen
In a WebFlux application, the usual way is to return the Mono from the handler. WebFlux subscribes to it and writes the result to the HTTP response. Spring MVC also accepts Mono return values from controllers and subscribes to them, completing the response asynchronously.
In plain service code in an MVC application, we can block, which subscribes and waits for the result on the current thread. Or, for a fire-and-forget call, we can subscribe explicitly; then we must handle errors ourselves, because nobody else will see them.
Notice the timeout on block(). Without a timeout in the WebClient configuration or on block(), a hanging downstream would hold the MVC thread indefinitely. The fire-and-forget form loses the call if the application shuts down at the wrong moment, so for audit events that must not be lost, a durable queue is a better fit than an in-memory subscribe().
4Block() Is Fine on Request Threads, Never on Event Loops
In Spring MVC, each request runs on its own servlet container thread, a Tomcat thread for example, and blocking that thread is the normal way MVC works. So block() there costs nothing special: the thread waits for the response, just as it would with RestTemplate.
In WebFlux the situation is different. Requests run on a small number of event-loop threads, typically one per CPU core, and each of them serves thousands of connections. If one of them blocks for 200 milliseconds, every connection it serves freezes for 200 milliseconds. Reactor protects against this: calling block() on a thread marked as non-blocking, such as a Reactor Netty event-loop thread, throws an IllegalStateException straight away.
5Should This Service Use WebClient at All?
If the service is a blocking MVC application and every WebClient call ends in block(), WebClient brings in Reactor and a reactive HTTP stack only to be used in a blocking way, and it brings exactly the trap we just saw. RestClient, available since Spring Framework 6.1, offers the same fluent style but runs the request immediately when we call body() or toBodilessEntity(), so there is nothing to forget.
So for a fully blocking service, I would move to RestClient. WebClient remains the right choice where the code really is reactive, for example when we call several services in parallel and combine the results with Mono.zip.
6Follow-up questions
What happens if you call block() inside a WebFlux handler?
If the handler runs on a Reactor Netty event-loop thread, which is the default, Reactor detects that the thread is non-blocking and throws IllegalStateException, with a message saying that block() is not supported in that thread, such as reactor-http-nio-3. If it were allowed, it would freeze every connection served by that event loop. The fix is to return the Mono and compose with operators such as flatMap, or, for unavoidable blocking code, move it to Schedulers.boundedElastic() with subscribeOn.
Why did no error appear anywhere?
Because there was nothing to fail. An unsubscribed Mono is just an object that the garbage collector removes. Static analysis and IDE inspections can flag an ignored reactive return value, which is worth enabling in codebases that use Reactor.
7Conclusion
In this answer, we saw that the WebClient call sent nothing because Reactor is lazy: retrieve() and bodyToMono() only describe the request, and it runs when a subscriber subscribes. If the Mono is not returned to WebFlux or a Spring MVC controller, and not subscribed or blocked on, it is simply discarded. block() is acceptable on MVC request threads, with a timeout, but throws on event-loop threads, and a fully blocking service is better served by RestClient, which executes the request directly.
Open with
The request is never made because Reactor is lazy. webClient.get().uri(url).retrieve().bodyToMono(Dto.class) just builds a Mono, which is a description of the call; the HTTP request is only sent when something subscribes to that Mono.
Then, if they want more
In a WebFlux handler you return the Mono and the framework subscribes, and Spring MVC controllers can also return a Mono. But in this code the Mono is created in a service method and its return value is ignored, so nobody subscribes, and it is just garbage collected.
No error, and the log lines around it still print, which makes it confusing. The fix in a blocking MVC service is to call block, ideally with a timeout, which subscribes and waits on the request thread; that's acceptable because MVC threads are meant to block.
For fire-and-forget I could call subscribe with an error handler, though for something like audit events I would prefer a durable queue. What I must never do is block on an event-loop thread in WebFlux: Reactor throws an IllegalStateException there, because blocking would freeze every connection on that loop.
And honestly, if the whole service is blocking, I would switch to RestClient, which sends the request immediately when you call body, so this mistake cannot happen.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Framework 6
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
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 "A Spring MVC service calls webClient.get().uri(url).retrieve().bodyToMono(Dto.class) but...": https://scrivio-interview-library.netlify.app/spring-boot/http-clients/82ce15b2bf/