Set timeout for specific async request in Spring-boot

后端 未结 2 849
谎友^
谎友^ 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

    0 讨论(0)
  • 2021-01-18 19:31

    Can you please try to add below property in application.properties.

    spring.mvc.async.request-timeout = # Amount of time (in milliseconds) before asynchronous request handling times out.

    0 讨论(0)
提交回复
热议问题