当前位置: 代码迷 >> 综合 >> 在spring-mvc.xml里配置异步
  详细解决方案

在spring-mvc.xml里配置异步

热度:65   发布时间:2023-11-02 13:34:02.0

<!--配置对应的package名-->

<context:component-scan base-package="com.sycamore.asynchronous" />            

<!--开启注解调度支持 @Async @Scheduled -->
<task:scheduler id="scheduler" pool-size="10" />
<task:annotation-driven executor="executor"
scheduler="scheduler" />
<task:executor id="executor" pool-size="10"
queue-capacity="10" />
<!-- 注解驱动,使spring的controller全部生效 -->

<aop:aspectj-autoproxy proxy-target-class="true" expose-proxy="true"/> 



在对应的package下  要用到异步的方法 加上    @Async   注解

  相关解决方案