在Spring-boot中为特定的异步请求设置超时 [英] Set timeout for specific async request in Spring-boot

查看:95
本文介绍了在Spring-boot中为特定的异步请求设置超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同步端点定义如下:

I have an sync endpoint defined as follows:

@PostMapping("/some/url/")
@ResponseBody
public Future<String> something(...) {
    ... do stuff ...
}

30秒后返回的 Future 未完成时,请求将被取消.

When the returned Future is not completed after 30 seconds the request is cancelled.

如何增加此特定端点的超时时间(例如,增加到100秒)?

How can I increase the timeout for this specific endpoint (e.g. to 100 seconds)?

我只找到了针对所有端点修改它的答案:

I only found answers for changing it for all endpoins:

推荐答案

您可以返回来自文档: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆