According to the doc :
The response body can be one of the following:
- Account — serialize without blocking the given Account; implies a synchronous, non-blocking controller method.
How come a synchronous controller method can be non-blocking? It sounds like a contradiction.
Here is an example of a synchronous, non-blocking controller method:
@GetMapping("/sample/account")
public Account sample() {
return new Account("codependent");
}
It's synchronous because it does not return a type that signals a deferred result (like Mono
or Flux
). It's non-blocking because no blocking operation is performed (I/O, waiting on a shared resource, etc).
You could wrap it with a Mono
like Mono.just(new Account("codependent"))
, but you'd just pay the cost of that async type for no reason.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.