Reputation: 46890
I'm going through this tutorial which explains the difference between using a Callable
and a DeferredResult
with the servlet 3.0 spec and Spring. For Callable
s spring manages the thread, so I presume then that we need to configure a thread pool? How is this configured for Spring Boot?
Upvotes: 2
Views: 3011
Reputation: 2253
WebMvcConfigurationSupport.configureAsyncSupport() is used to set up async request processing. AsyncSupportConfigurer provides configuration for all controller methods returning Callable
and DeferredResult
. The underlying thread pool can be configured through AsyncSupportConfigurer.setTaskExecutor() using appropriate AsyncTaskExecutor
implementation (ThreadPoolTaskExecutor
for example). It's also possible to update this configuration on per-request basis by returning WebAsyncTask
instead for Callable
. Linked javadocs describe all of it in more detail.
Upvotes: 3