spring基于xml配置scheduled任务多线程执行

 scheduled默认是单线程串行,需要配置线程池

以下是基于xml配置

 <task:scheduler id="scheduler" pool-size="4" />
    <task:scheduled-tasks scheduler="scheduler">
        <task:scheduled ref="pmTask" method="getMinutePm" cron="0 0/1 * * * ?"/>
        <task:scheduled ref="outsidePmTask" method="getOutsidePm" cron="0 30/30 * * * ?"/>
        <task:scheduled ref="pmTask" method="getHourPm" cron="0 0 0/1 * * ? "/>
        <task:scheduled ref="pmTask" method="getDayPm" cron="0 0 0 1/1 * ? "/>
    </task:scheduled-tasks>

基于注解配置: https://blog.csdn.net/corleone_4ever/article/details/104293012

发布了206 篇原创文章 · 获赞 45 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/corleone_4ever/article/details/105457243
今日推荐