I am working on a project using Hibernate JPA and Spring MVC, I am looking into implementing an asynchronous service, and I realized that I am getting the two annotations @Async or @Asynchronous from repectively Spring and EJB.
Everything here is pretty new for me, and I would go for the EJB @Asynchronous and see how it goes, I was wondering if one solution has an advantage over the other?
@Asyncand@Asynchronousare identical in their capabilities. They both run given method in a separate thread pool and they both allowvoidandFuture<T>result type. There is no functional different between them. The only (minor) advantage of Spring is that you have full control over underlying thread pool while with@Asynchronousthis is probably configured on a container-specific basis.If your application already uses Spring MVC,
@Asyncseems like a natural consequence.