Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top