FactoryBean that sets up a Quartz Scheduler and exposes it for bean references.
Allows registration of JobDetails, Calendars and Triggers, automatically
starting the scheduler on initialization and shutting it down on destruction.
In scenarios that just require static registration of jobs at startup, there
is no need to access the Scheduler instance itself in application code.
For dynamic registration of jobs at runtime, use a bean reference to
this SchedulerFactoryBean to get direct access to the Quartz Scheduler
(org.quartz.Scheduler). This allows you to create new jobs
and triggers, and also to control and monitor the entire Scheduler.
Note that Quartz instantiates a new Job for each execution, in
contrast to Timer which uses a TimerTask instance that is shared
between repeated executions. Just JobDetail descriptors are shared.
When using persistent jobs, it is strongly recommended to perform all
operations on the Scheduler within Spring-managed (or plain JTA) transactions.
Else, database locking will not properly work and might even break.
(See setDataSource javadoc for details.)
The preferred way to achieve transactional execution is to demarcate
declarative transactions at the business facade level, which will
automatically apply to Scheduler operations performed within those scopes.
Alternatively, define a TransactionProxyFactoryBean for the Scheduler itself.
SchedulerFactoryBean is fully compatible with both Quartz 1.3
and 1.4 (through special checks where necessary).
Allows registration of JobDetails, Calendars and Triggers, automatically starting the scheduler on initialization and shutting it down on destruction. In scenarios that just require static registration of jobs at startup, there is no need to access the Scheduler instance itself in application code.
For dynamic registration of jobs at runtime, use a bean reference to this SchedulerFactoryBean to get direct access to the Quartz Scheduler (
org.quartz.Scheduler). This allows you to create new jobs and triggers, and also to control and monitor the entire Scheduler.Note that Quartz instantiates a new Job for each execution, in contrast to Timer which uses a TimerTask instance that is shared between repeated executions. Just JobDetail descriptors are shared.
When using persistent jobs, it is strongly recommended to perform all operations on the Scheduler within Spring-managed (or plain JTA) transactions. Else, database locking will not properly work and might even break. (See setDataSource javadoc for details.)
The preferred way to achieve transactional execution is to demarcate declarative transactions at the business facade level, which will automatically apply to Scheduler operations performed within those scopes. Alternatively, define a TransactionProxyFactoryBean for the Scheduler itself.
SchedulerFactoryBean is fully compatible with both Quartz 1.3 and 1.4 (through special checks where necessary).