Cron表达式无法正常工作于Spring Boot

问题描述

到目前为止,我不会让方法在每个星期日的下午1:30运行,但是我可以让事情像每10分钟或每天的1:30运行,但现在是特定的日子

这是我到目前为止的

 /**
     * Fires at 1:30 PM sundauy
     */
    @Scheduled(cron = "0 30 13 * 1 ?")
    fun sendNotifications() {

    }

我认为问题可能出在月日字段中?或星期日未索引为1。我在其他con实现中看到它的0。

解决方法

第5个字段用于“月”,而第6个字段用于“星期几”(请参见herehere),因此您的表达式( for i = 0,b - 1 do -- the default increment is 1. out[i + 1] = a - i end )将触发方法是“一月的每天13:30”。

工作日名称可以指定为英文名称的前三个字母。为了安排运行“每周日13:30”的方法,可以使用以下表达式:

"0 30 13 * 1 ?"