@Scheduled(fixedRate=5000)
    public void demoServiceMethod()
    {

    }

    @Autowired
    JobOrderService joborderSerivce;

    @Scheduled(cron = "0 0 17 ? * SUN,MON,TUE,WED,THU,FRI,SAT")
    public void ScheduledMethod() {

    }

    @Scheduled(cron = "0/2 0 0 ? * SUN,MON,TUE,WED,THU,FRI,SAT")
    public void ScheduledMethod2() {

    }

fixed rate is working. It runs every 5 seconds but the next methods doesn't run. Is my cron wrong? I wanted to have a scheduled task everyday 5pm, the other one is a test, everyday 2 seconds.

有帮助吗?

解决方案

instead of giving SUN, MON .... use below cron expression

0 0 17 * * ?

check for your reference Cron Expression

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top