spring @Scheduled ,默认基于单线程执行,如果需要基于多线程执行,需要在配置文件中配置如下
<task:scheduler id="scheduler" pool-size="10" />
<task:executor id="executor" keep-alive="7200" pool-size="100-200"
queue-capacity="500" rejection-policy="CALLER_RUNS" />
<task:annotation-driven executor="executor"
scheduler="scheduler" />
具体可以参考spring 帮助文档对annotation-driven的executor和scheduler的解释
时间: 2024-08-27 07:34:12