2
votes

I have following spring job to run every day two times please check my following cron express is that correct to trigger every day two times.

@Scheduled(cron = "0 0 24/12 * ? *")
public void demoService()
{

}

I tried the above expression, but this didn't work. What's wrong here?

1
Use expression "0 0 12,0 1/1 * ? *" and you can find next occurance on [link] cronmaker.com. - 2787184

1 Answers

3
votes

You could use

0 0 0/12 * * ?

which means every 12 hours.

@Scheduled(cron = "0 0 0/12 * * ?")
public void demoService()
{

}

Hope it could help.