This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

scheduled batch runs more than once

Apr 27th, 2011, 06:30 PM

Hi,

I'm using a SimpleJobLauncher with SimpleAsyncTaskExecutor to run a batch with a daily cron. The cron runs at the proper time, but it runs like 60 times in a row for some odd reason. I've invoked the jobLauncher manually and insured that my code doesn't actually run the batch 60 times. Any ideas what it could be? My config is below:

ok, so your cron expression should be 0 1 21 * * * instead of * 1 21 * * *. This one should also work: 0 1 21 * * ? (you don't specify the day twice, but it doesn't matter in this case).

Is the cron expression similar to the system cron flags?

cron expressions in Spring (and Quartz) use the same syntax as the system cron's ones (e.g. *, ?, 0/*, etc.), except there's an additional field for seconds (on the left). The last field (on the right) is for years, but it's optional.