Task Execution and Scheduling
The Spring Framework provides abstractions for the asynchronous execution and scheduling of
tasks with the TaskExecutor
and TaskScheduler
interfaces, respectively. Spring also
features implementations of those interfaces that support thread pools or delegation to
CommonJ within an application server environment. Ultimately, the use of these
implementations behind the common interfaces abstracts away the differences between Java
SE 5, Java SE 6, and Java EE environments.
Spring also features integration classes to support scheduling with the Timer
(part of the JDK since 1.3) and the Quartz Scheduler ( https://www.quartz-scheduler.org/).
You can set up both of those schedulers by using a FactoryBean
with optional references to
Timer
or Trigger
instances, respectively. Furthermore, a convenience class for both
the Quartz Scheduler and the Timer
is available that lets you invoke a method of
an existing target object (analogous to the normal MethodInvokingFactoryBean
operation).