By default, will be searching for an associated scheduler definition: either
a unique TaskScheduler bean in the context,
or a TaskScheduler bean named "taskScheduler" otherwise; the same lookup
will also be performed for a ScheduledExecutorService
bean. If neither of the two is resolvable, a local single-threaded default
scheduler will be created and used within the registrar.

When more control is desired, a @Configuration class may implement
SchedulingConfigurer. This allows access to the underlying
ScheduledTaskRegistrar instance. For example, the following example
demonstrates how to customize the Executor used to execute scheduled
tasks:

Note in the example above the use of @Bean(destroyMethod="shutdown").
This ensures that the task executor is properly shut down when the Spring
application context itself is closed.

Implementing SchedulingConfigurer also allows for fine-grained
control over task registration via the ScheduledTaskRegistrar.
For example, the following configures the execution of a particular bean
method per a custom Trigger implementation:

The examples are equivalent save that in XML a fixed-rate period is used
instead of a custom Trigger implementation; this is because the
task: namespace scheduled cannot easily expose such support. This is
but one demonstration how the code-based approach allows for maximum configurability
through direct access to actual componentry.