spring-framework / org.springframework.scheduling.quartz / JobDetailFactoryBean

JobDetailFactoryBean

open class JobDetailFactoryBean : FactoryBean<JobDetail>, BeanNameAware, ApplicationContextAware, InitializingBean

A Spring FactoryBean for creating a Quartz org.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.

Author
Juergen Hoeller

Since
3.1

See Also
#setName#setGrouporg.springframework.beans.factory.BeanNameAwareorg.quartz.Scheduler#DEFAULT_GROUP

Constructors

<init>

JobDetailFactoryBean()

A Spring FactoryBean for creating a Quartz org.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.

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

getJobDataMap

open fun getJobDataMap(): JobDataMap

Return the job's JobDataMap.

getObject

open fun getObject(): JobDetail

getObjectType

open fun getObjectType(): Class<*>

isSingleton

open fun isSingleton(): Boolean

setApplicationContext

open fun setApplicationContext(applicationContext: ApplicationContext): Unit

setApplicationContextJobDataKey

open fun setApplicationContextJobDataKey(applicationContextJobDataKey: String): Unit

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.

setBeanName

open fun setBeanName(beanName: String): Unit

setDescription

open fun setDescription(description: String): Unit

Set a textual description for this job.

setDurability

open fun setDurability(durability: Boolean): Unit

Specify the job's durability, i.e. whether it should remain stored in the job store even if no triggers point to it anymore.

setGroup

open fun setGroup(group: String): Unit

Specify the job's group.

setJobClass

open fun setJobClass(jobClass: Class<out Job>): Unit

Specify the job's implementation class.

setJobDataAsMap

open fun setJobDataAsMap(jobDataAsMap: MutableMap<String, *>): Unit

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.

setJobDataMap

open fun setJobDataMap(jobDataMap: JobDataMap): Unit

Set the job's JobDataMap.

setName

open fun setName(name: String): Unit

Specify the job's name.

setRequestsRecovery

open fun setRequestsRecovery(requestsRecovery: Boolean): Unit

Set the recovery flag for this job, i.e. whether or not the job should get re-executed if a 'recovery' or 'fail-over' situation is encountered.