title: How to use Spring AsyncResult and Future Return
body: <p>I have a public interface, Synchronous, that gets exposed to several service layer classes.  Its intent is to lookup an object graph based on the id being passed, do some business logic and then pass it on to the Spring Asynchronous method Asynchronous.doWork to finish the rest of the task.  </p>
  
  <p>I'm trying to use the Spring AsyncResult but I'm unsure what the returned object WorkResult actually gets returned to. Do I need to put a handler somewhere in the SynchronousImpl? Ideas? </p>
  
  <p><strong>Sync Public Service:</strong></p>
  
  <pre><code>public class SynchronousImpl implements Synchronous {
      private Asynchronous async;
      //business logic
      public void doWork(long id){
          async.doWork(id);
      }
  }
  </code></pre>
  
  <p><strong>Async Worker Class:</strong></p>
  
  <pre><code>public class Asynchronous {
      @Async
      public Future&lt;WorkResult&gt; doWork(long id){
          //business logic
          WorkResult result = new WorkResult(id, "Finished");
          return new AsyncResult&lt;WorkResult&gt;(result);
      }
  }
  </code></pre>