Class SpringBeanJobFactory
- All Implemented Interfaces:
- JobFactory,- Aware,- ApplicationContextAware,- SchedulerContextAware
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
 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.
Compatible with Quartz 2.1.4 and higher, as of Spring 4.1.
- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectcreateJobInstance(TriggerFiredBundle bundle) Create the job instance, populating it with property values taken from the scheduler context, job data map and trigger data map.protected booleanisEligibleForPropertyPopulation(Object jobObject) Return whether the given job object is eligible for having its bean properties populated.voidsetApplicationContext(ApplicationContext applicationContext) Set the ApplicationContext that this object runs in.voidsetIgnoredUnknownProperties(String... ignoredUnknownProperties) Specify the unknown properties (not found in the bean) that should be ignored.voidsetSchedulerContext(SchedulerContext schedulerContext) Set the SchedulerContext of the current Quartz Scheduler.Methods inherited from class org.springframework.scheduling.quartz.AdaptableJobFactoryadaptJob, newJob
- 
Constructor Details- 
SpringBeanJobFactorypublic SpringBeanJobFactory()
 
- 
- 
Method Details- 
setIgnoredUnknownPropertiesSpecify 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).
- 
setApplicationContextDescription copied from interface:ApplicationContextAwareSet the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as InitializingBean.afterPropertiesSet()or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)andMessageSourceAware, if applicable.- Specified by:
- setApplicationContextin interface- ApplicationContextAware
- Parameters:
- applicationContext- the ApplicationContext object to be used by this object
- See Also:
 
- 
setSchedulerContextDescription copied from interface:SchedulerContextAwareSet the SchedulerContext of the current Quartz Scheduler.- Specified by:
- setSchedulerContextin interface- SchedulerContextAware
- See Also:
 
- 
createJobInstanceCreate the job instance, populating it with property values taken from the scheduler context, job data map and trigger data map.- Overrides:
- createJobInstancein class- AdaptableJobFactory
- 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- if job instantiation failed
 
- 
isEligibleForPropertyPopulationReturn whether the given job object is eligible for having its bean properties populated.The default implementation ignores QuartzJobBeaninstances, which will inject bean properties themselves.- Parameters:
- jobObject- the job object to introspect
- See Also:
 
 
-