I'm trying to call a method in Spring-powered bean asynchronously using @Async. I defined an executor in XML:

<task:executor id="emailTasksExecutor" pool-size="1" />

and here is my method:

@Override
@Async("emailTasksExecutor")
public void sendEmail()
{
    ...
}

And the method does not get called at all when I use qualifier (emailTasksExecutor). However, if I remove it, everything works ok. But in this case the default executor is used and I need to change this behaviour.

I thought the problem is that my class does not implement any interfaces, and something went wrong with proxies. But extracting the interface did not help.

有帮助吗?

解决方案

So, the problem was my maven-aspectj-plugin. I found the solution here. All I need to do is to add mode="aspectj" to the task:annotation-driven.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top