From the course: Complete Guide to Spring MVC
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
DeferredResult - Spring Tutorial
From the course: Complete Guide to Spring MVC
DeferredResult
- [Instructor] DeferredResult. Asynchronous processing in Spring MVC allows you to handle long running or I/O bound task without blocking the main thread, improving scalability and responsiveness. Deferred route a key part of this system lets you return a result to the client asynchronously. This is especially useful for operations like fetching external data, performing background jobs, or handling real-time updates. So how does DeferredResult work? A DeferredResult object is returned immediately from the controller method. The server thread is released back to the pool, freeing it for other requests, and the actual computation or task runs on another thread. Once the task completes, the DeferredResult is populated with the result and the response is sent back to the client. Let's use DeferredResult in Spring MVC for an example. In this example, we're going to create an asynchronous endpoint with DeferredResult. So what we have here at play is that the controller method creates a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.