各位,
我的http端点返回completablefuture
@HttpEndpoint
public CompletableFuture<Student> processStudent(Request request){
return CompletableFuture.supplyAsync(()->saveStudent(request));
}
我的http客户端是
studentCompletableFuture = restTemplate.postForObject(URL, request, CompletableFuture.class);
Student student = studentCompletableFuture .get();
我不能让学生回到客户那里。
我在google和stackoverflow中搜索发现,一旦我们得到completablefuture,服务器的响应为placeholder(空响应),http连接将被关闭,我们无法应用get()来获取学生数据。
我的rest端点应该是异步的,如何将实际的学生响应返回到客户端?
暂无答案!
目前还没有任何答案,快来回答吧!