Question

    @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.

Was it helpful?

Solution

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

0 0 17 * * ?

check for your reference Cron Expression

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top