spring-task的属性理解
程序员文章站
2024-02-22 23:40:52
...
案例:
<task:scheduled-tasks>
<!-- <task:scheduled ref="timeJob" method="getWeChatOpenId" cron="0 0/1 * * * ?" /> -->
<!-- <task:scheduled ref="timeJob" method="getWeChatOpenId" cron="0 50 23 1/1 * ? " /> -->
<task:scheduled ref="xytimeJob" method="executeXYWithout" cron="0 0/1 * * * ?" />
<!-- <task:scheduled ref="buJianTimeOut" method="rejectBuJianTimeOut" cron="0 0 0 * * ?" /> -->
<task:scheduled ref="buJianTimeOut" method="rejectBuJianTimeOut" cron="0 0/1 * * * ?" />
<task:scheduled ref="timeJob" method="withholdSign" cron="0 0/1 * * * ? " />
</task:scheduled-tasks>
ref注入类,注入定时任务的bean
method是工作类中要执行的方法
fixed-delay是上一个调用完成后再次调用的延时
fixed-rate是上一个调用开始后再次调用的延时(并行执行,不用等待上一次调用完成)
cron是表达式,表示在什么时候进行任务调度(使用cron表达式的时候task是串行的)。
下一篇: sqlserver分页查询语法