I have a web/core module project. I get this error "Only one AsyncAnnotationBeanPostProcessor may exist within the context" in my Eclipse / STS environment even though the application starts up just fine in Tomcat. I feel that this is not a real error but as it is identified it leads to problems in building my project and I want to get rid of it.
I'm pretty sure I don't import the resource that contains the task:annotation-driven executor="myExecutor" scheduler="myScheduler" multiple times, at least not explicitly.
I use Quartz but I'm not using @Scheduled, I create the scheduled beans through xml. I do use @Async throughout the application.
I have in my web project:
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/root-context.xml
/WEB-INF/security.xml
</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
root-context.xml
<import resource="classpath*:/spring/applicationContext-schedule.xml" />
<import resource="classpath*:/spring/applicationContext-ology.xml" />
<import resource="classpath*:/spring/applicationContext-mercadosa.xml" />
<import resource="classpath*:/spring/applicationContext-webapp.xml" />
<import resource="classpath*:/spring/applicationContext-ws.xml" />
<import resource="classpath*:/spring/applicationContext-services.xml" />
<import resource="classpath*:/spring/applicationContext.xml" />
<import resource="classpath*:/spring/applicationContext-transaction.xml" />
<import resource="classpath*:/spring/applicationContext-dao.xml" />
<import resource="classpath*:/spring/applicationContext-facet.xml" />
<import resource="classpath*:/spring/applicationContext-social.xml" />
applicationContext-scheduled.xml
<task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
<task:executor
id="myExecutor"
pool-size="5-10"
queue-capacity="25"
rejection-policy="CALLER_RUNS"/>
<task:scheduler id="myScheduler" pool-size="3"/>
<bean
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
....
</list>
</property>
<property name="quartzProperties" value="classpath:quartz.properties"/>
[....]
</bean>
test/resources/applicationContext-test.xml both in core and web
<task:executor id="myExecutor" pool-size="5-10" queue-capacity="25" rejection-policy="CALLER_RUNS" />
test resources don't contain any task:annotation-driven statements.
Any suggestions?
Cheers, Marc