June 2018
Intermediate to advanced
408 pages
11h 23m
English
The CompletableFuture class was introduced in Java 8, and it provides a simple way to write asynchronous, multithreaded, non-blocking code. With Spring MVC, it is also possible to use CompletableFuture with controllers, services, and repositories from public methods annotated with @Async. CompletableFuture implements the Future interface, which provides the result of an asynchronous computation.
We can create CompletableFuture in the following simple way:
CompletableFuture<String> completableFuture = new CompletableFuture<String>();
To get the result of this CompletableFuture, we can call the CompletableFuture.get() method. This method will be blocked until Future is completed. For that, we can manually ...
Read now
Unlock full access