【发布时间】:2011-05-02 22:07:50
【问题描述】:
我正在使用@Scheduled,它工作正常,但无法让@Async 工作。我测试了很多次,似乎它使我的方法异步。我还缺少其他任何东西、配置或参数吗?我有一个类有两个方法,一个是用@Scheduled 标记的方法,执行并调用第二个用@Async 标记的方法。
这是我的配置:
<!-- Scans within the base package of the application for @Components to configure as beans -->
<context:component-scan base-package="com.socialmeety" />
<context:annotation-config />
<tx:annotation-driven transaction-manager="transactionManager" />
<task:annotation-driven/>
<!-- Configures support for @Controllers -->
<mvc:annotation-driven />
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<dwr:configuration />
<dwr:annotation-config />
<dwr:url-mapping />
<dwr:controller id="dwrController" debug="true" />
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
谢谢。
【问题讨论】:
-
您应该提供更多信息。 (代码 sn-ps 等)
-
没有任何异常,它只是没有使方法异步。有什么特别的配置可以让它工作吗?这是我的问题,将发布我的配置以更多地了解我的环境。我的@Scheduled 已经可以正常工作了。