How can I return a Future object with Spring without writing concurrency logic?

Posted by Johan on Stack Overflow See other posts from Stack Overflow or by Johan
Published on 2010-05-24T20:26:25Z Indexed on 2010/05/24 20:31 UTC
Read the original article Hit count: 188

Filed under:
|

How can I return a java.util.concurrent.Future object with a Receipt object and only use the @javax.ejb.Asynchronous annotation?

And do I need any extra configuration to let Spring handle ejb annotations?

I don't want to write any concurrency logic myself.

Here's my attempt that doesn't work:

@Asynchronous
public Future<Receipt> execute(Job job) {
    Receipt receipt = timeConsumingWork(job);
    return receipt;
}

© Stack Overflow or respective owner

Related posts about spring

Related posts about concurrency