Difference between Spring MVC's @Async, DeferredResult and Callable

前端 未结 3 1651
攒了一身酷
攒了一身酷 2021-01-31 09:56

I\'ve a long-running task defined in a Spring service. It is started by a Spring MVC controller. I want to start the service and return back an HttpResponse to the

3条回答
  •  终归单人心
    2021-01-31 10:02

    DeferredResult takes advantage of the Servlet 3.0 AsyncContext. It will not block the thread like the others will when you need a result returned.

    Another big benefit is that DeferredResult supports callbacks.

提交回复
热议问题