For example, let's assume that the JobDataMap contains a key "myParam" with value "5": The Job implementation can then expose a bean property "myParam" of type int to receive such a value, i.e. a method "setMyParam(int)". This will also work for complex types like business objects etc.
Note that the preferred way to apply dependency injection
to Job instances is via a JobFactory: that is, to specify
SpringBeanJobFactory as Quartz JobFactory (typically via
SchedulerFactoryBean's "jobFactory" property).
This allows to implement dependency-injected Quartz Jobs without
a dependency on Spring base classes.
org.quartz.JobExecutionContext#getMergedJobDataMap() , org.quartz.Scheduler#getContext() , SchedulerFactoryBean#setSchedulerContextAsMap, SpringBeanJobFactory, SchedulerFactoryBean#setJobFactory
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | execute(org.
This implementation applies the passed-in job data map as bean property
values, and delegates to |
| protected abstract void |
| QuartzJobBean | back to summary |
|---|---|
| public QuartzJobBean() | |
| execute | back to summary |
|---|---|
| public final void execute(org. This implementation applies the passed-in job data map as bean property
values, and delegates to
| |
| executeInternal | back to summary |
|---|---|
| protected abstract void executeInternal(org. Execute the actual job. The job data map will already have been applied as bean property values by execute. The contract is exactly the same as for the standard Quartz execute method.
| |