上下文中可能只存在一个AsyncAnnotationBeanPostProcessor

Mar*_*arc 5 eclipse spring spring-mvc

我有一个web /核心模块项目.我在Eclipse/STS环境中遇到此错误"上下文中只存在一个AsyncAnnotationBeanPostProcessor",即使应用程序在Tomcat中启动得很好.我觉得这不是一个真正的错误,但是因为它确定了它会导致构建我的项目的问题,我想摆脱它.

我很确定我不会导入包含任务的资源:annotation-driven executor ="myExecutor"scheduler ="myScheduler"多次,至少没有明确说明.

我使用Quartz但是我没有使用@Scheduled,我通过xml创建了预定的bean.我在整个应用程序中使用@Async.

我在我的网络项目中:

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>  
Run Code Online (Sandbox Code Playgroud)

根的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" />  
Run Code Online (Sandbox Code Playgroud)

的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>  
Run Code Online (Sandbox Code Playgroud)

核心和Web中的test/resources/applicationContext-test.xml

    <task:executor id="myExecutor" pool-size="5-10" queue-capacity="25" rejection-policy="CALLER_RUNS" />  
Run Code Online (Sandbox Code Playgroud)

测试资源不包含任何任务:注释驱动的语句.

有什么建议?

干杯,马克