In Spring @Async , If i want to have multiple executor pool with different queue capacity - I get the error "Only one AsyncAnnotationBeanPostProcessor may exist within the context".
From the below links I observe that this is not feasible .
Only one AsyncAnnotationBeanPostProcessor may exist within the context
Spring's @Scheduled error : Only one AsyncAnnotationBeanPostProcessor may exist within the context
http://forum.spring.io/forum/spring-projects/container/79086-multiple-executor-possible
Is there any alternative ( other than using spring-integration )
Below is my configuration
My configuration is like below
<!- Executor A -->
<task:annotation-driven executor="executor_A"/>
<task:executor id="executor_A" pool-size="100"/>
<!- Executor B -->
<task:annotation-driven executor="executor_B"/>
<task:executor id="executor_B" pool-size="100"/>
The above two configurations are defined in different xml context files and all are loaded in to same application context
From the source code , I am mapping to the specific executor
@Async("executor_A")
public void testExecutorA()
{
}
@Async("executor_B")
public void testExecutorB()
{
}
When I deploy , I get the below error
2014-07-22 09:41:26.644 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader U: SC: TX: - Context initialization failed org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:/META-INF/domainconfig/*-domain-context.xml] Offending resource: ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context. Offending resource: URL [jar:file:/D:/tomcat/apache-tomcat-7.0.29/webapps/myapp/WEB-INF/lib/myapp-domain-1.0.0.jar!/META-INF/domainconfig/my-domain-context.xml]
Thanks
Lives