Set timeout for specific async request in Spring-boot

后端 未结 2 850
谎友^
谎友^ 2021-01-18 19:23

I have an sync endpoint defined as follows:

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


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-18 19:31

    You can return WebAsyncTask that supports timeout.

    From docs: For a Callable, you can use WebAsyncTask to provide a timeout value

提交回复
热议问题