Quartz one time job on application startup

Rakesh picture Rakesh · Dec 27, 2012 · Viewed 10.2k times · Source

I am trying to integrate a Quartz job in my spring application. I got this example from here. The example shows jobs executing at repeated intervals using a simpletrigger and at a specific time using a crontrigger.

My requirement is to run the job only once on application startup. I removed the property repeatInterval, but the application throws an exception :

org.quartz.SchedulerException: Repeat Interval cannot be zero

Is there any way to schedule a job just once ?

Thanks..

Answer

Rakesh picture Rakesh · Dec 27, 2012

Found the answer here

Ignoring the repeatInterval and setting repeatCount = 0 does what I wanted.