RestTemplate可能不是一个好主意。根据文档,AsyncRestClient公开了与RestTemplate类似的方法,但返回了
我需要在春季启动应用程序中异步调用api?有什么方法可以在Spring RestTemplate中使用吗?
ListenableFuture
包装,而不是具体的结果。此外,WebClient将是一个比AsyncRestClient更好的选择,后者已被弃用。如链接页面所示,它是
已弃用。从Spring 5.0开始,支持WebClient