public class

SpringBeanJobFactory

extends AdaptableJobFactory
implements SchedulerContextAware
java.lang.Object
   ↳ org.springframework.scheduling.quartz.AdaptableJobFactory
     ↳ org.springframework.scheduling.quartz.SpringBeanJobFactory

Class Overview

Subclass of AdaptableJobFactory that also supports Spring-style dependency injection on bean properties. This is essentially the direct equivalent of Spring's QuartzJobBean in the shape of a Quartz 1.5 org.quartz.spi.JobFactory.

Applies scheduler context, job data map and trigger data map entries as bean property values. If no matching bean property is found, the entry is by default simply ignored. This is analogous to QuartzJobBean's behavior.

Summary

Public Constructors
SpringBeanJobFactory()
Public Methods
void setIgnoredUnknownProperties(String[] ignoredUnknownProperties)
Specify the unknown properties (not found in the bean) that should be ignored.
void setSchedulerContext(SchedulerContext schedulerContext)
Set the SchedulerContext of the current Quartz Scheduler.
Protected Methods
Object createJobInstance(TriggerFiredBundle bundle)
Create the job instance, populating it with property values taken from the scheduler context, job data map and trigger data map.
boolean isEligibleForPropertyPopulation(Object jobObject)
Return whether the given job object is eligible for having its bean properties populated.
[Expand]
Inherited Methods
From class org.springframework.scheduling.quartz.AdaptableJobFactory
From class java.lang.Object
From interface org.springframework.scheduling.quartz.SchedulerContextAware

Public Constructors

public SpringBeanJobFactory ()

Public Methods

public void setIgnoredUnknownProperties (String[] ignoredUnknownProperties)

Specify the unknown properties (not found in the bean) that should be ignored.

Default is null, indicating that all unknown properties should be ignored. Specify an empty array to throw an exception in case of any unknown properties, or a list of property names that should be ignored if there is no corresponding property found on the particular job class (all other unknown properties will still trigger an exception).

public void setSchedulerContext (SchedulerContext schedulerContext)

Set the SchedulerContext of the current Quartz Scheduler.

Protected Methods

protected Object createJobInstance (TriggerFiredBundle bundle)

Create the job instance, populating it with property values taken from the scheduler context, job data map and trigger data map.

Parameters
bundle the TriggerFiredBundle from which the JobDetail and other info relating to the trigger firing can be obtained
Returns
  • the job instance
Throws
Exception

protected boolean isEligibleForPropertyPopulation (Object jobObject)

Return whether the given job object is eligible for having its bean properties populated.

The default implementation ignores QuartzJobBean instances, which will inject bean properties themselves.

Parameters
jobObject the job object to introspect
See Also