Put @Async on a service method that calls the "real" service method. So you have two ways to call it, asynchronous and non-asynchronous.
Ask the controller method to keep the future returned by the service in the session, and then return. Then, when the client polls the controller (using a different URL / method), the controller can infer the Future from the session and call isDone () on it.
source
share