From the course: Spring: Spring MVC

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Return callable in Controller

Return callable in Controller

From the course: Spring: Spring MVC

Start my 1-month free trial

Return callable in Controller

- [Instructor] Now we are supposed to return a Callable of String from Controllers instead of a normal String value. We've already spoken of this before in our slides videos where we said that instead of returning a String, if you want Async processing capability you need to return a Callable of String, or a DeferredReult of String. So that's the next change we're going to do. Let's com back to IDE. Let's pick up one of our Controllers, let's say I'm going to take the SearchController, and this is what we're going to modify. So now on line 22, if you look at the Controller method search, it returns you a String right now. Instead of this I'm going to return a Callable of String. So let's do that, which is going to look like this. Okay, once that's done, of course, now it is returning a Callable of String which means you need a Callable implementation out there inside that method. But before we do that we are just going…

Contents