Class JobDetailFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.FactoryBean<JobDetail>,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
FactoryBean for creating a Quartz JobDetail
instance, supporting bean-style usage for JobDetail configuration.
JobDetail(Impl) itself is already a JavaBean but lacks
sensible defaults. This class uses the Spring bean name as job name,
and the Quartz default group ("DEFAULT") as job group if not specified.
- Since:
- 3.1
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReturn the job's JobDataMap.Class<?>booleanvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetApplicationContextJobDataKey(String applicationContextJobDataKey) Set the key of an ApplicationContext reference to expose in the JobDataMap, for example "applicationContext".voidsetBeanName(String beanName) voidsetDescription(String description) Set a textual description for this job.voidsetDurability(boolean durability) Specify the job's durability, i.e.voidSpecify the job's group.voidsetJobClass(Class<? extends Job> jobClass) Specify the job's implementation class.voidsetJobDataAsMap(Map<String, ?> jobDataAsMap) Register objects in the JobDataMap via a given Map.voidsetJobDataMap(JobDataMap jobDataMap) Set the job's JobDataMap.voidSpecify the job's name.voidsetRequestsRecovery(boolean requestsRecovery) Set the recovery flag for this job, i.e.
-
Constructor Details
-
JobDetailFactoryBean
public JobDetailFactoryBean()
-
-
Method Details
-
setName
Specify the job's name. -
setGroup
Specify the job's group. -
setJobClass
Specify the job's implementation class. -
setJobDataMap
Set the job's JobDataMap. -
getJobDataMap
Return the job's JobDataMap. -
setJobDataAsMap
Register objects in the JobDataMap via a given Map.These objects will be available to this Job only, in contrast to objects in the SchedulerContext.
Note: When using persistent Jobs whose JobDetail will be kept in the database, do not put Spring-managed beans or an ApplicationContext reference into the JobDataMap but rather into the SchedulerContext.
- Parameters:
jobDataAsMap- a Map with String keys and any objects as values (for example Spring-managed beans)- See Also:
-
setDurability
public void setDurability(boolean durability) Specify the job's durability, i.e. whether it should remain stored in the job store even if no triggers point to it anymore. -
setRequestsRecovery
public void setRequestsRecovery(boolean requestsRecovery) Set the recovery flag for this job, i.e. whether the job should get re-executed if a 'recovery' or 'fail-over' situation is encountered. -
setDescription
Set a textual description for this job. -
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
setApplicationContextJobDataKey
Set the key of an ApplicationContext reference to expose in the JobDataMap, for example "applicationContext". Default is none. Only applicable when running in a Spring ApplicationContext.In case of a QuartzJobBean, the reference will be applied to the Job instance as bean property. An "applicationContext" attribute will correspond to a "setApplicationContext" method in that scenario.
Note that BeanFactory callback interfaces like ApplicationContextAware are not automatically applied to Quartz Job instances, because Quartz itself is responsible for the lifecycle of its Jobs.
Note: When using persistent job stores where JobDetail contents will be kept in the database, do not put an ApplicationContext reference into the JobDataMap but rather into the SchedulerContext.
- See Also:
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getObject
- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<JobDetail>
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<JobDetail>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<JobDetail>
-