Folks,
My http endpoint returns CompletableFuture
@HttpEndpoint
public CompletableFuture<Student> processStudent(Request request){
return CompletableFuture.supplyAsync(()->saveStudent(request));
}
My http client is
studentCompletableFuture = restTemplate.postForObject(URL, request, CompletableFuture.class);
Student student = studentCompletableFuture .get();
I am not able to get student back to the client .
I searched in google and stackoverflow and found that once we get CompletableFuture with placeholder (empty response) as response from server, http connection will be closed and we cannot apply get() to get the student data.
My rest endpoint should be async, how to get the actual student response back to client ?