Class CronTriggerFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.FactoryBean<CronTrigger>
,org.springframework.beans.factory.InitializingBean
FactoryBean
for creating a Quartz CronTrigger
instance, supporting bean-style usage for trigger configuration.
CronTrigger(Impl)
itself is already a JavaBean but lacks sensible defaults.
This class uses the Spring bean name as job name, the Quartz default group ("DEFAULT")
as job group, the current time as start time, and indefinite repetition, if not specified.
This class will also register the trigger with the job name and group of
a given JobDetail
. This allows SchedulerFactoryBean
to automatically register a trigger for the corresponding JobDetail,
instead of registering the JobDetail separately.
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Return the trigger's JobDataMap.Class<?>
boolean
void
setBeanName
(String beanName) void
setCalendarName
(String calendarName) Associate a specific calendar with this cron trigger.void
setCronExpression
(String cronExpression) Specify the cron expression for this trigger.void
setDescription
(String description) Associate a textual description with this trigger.void
Specify the trigger's group.void
setJobDataAsMap
(Map<String, ?> jobDataAsMap) Register objects in the JobDataMap via a given Map.void
setJobDataMap
(JobDataMap jobDataMap) Set the trigger's JobDataMap.void
setJobDetail
(JobDetail jobDetail) Set the JobDetail that this trigger should be associated with.void
setMisfireInstruction
(int misfireInstruction) Specify a misfire instruction for this trigger.void
setMisfireInstructionName
(String constantName) Set the misfire instruction via the name of the corresponding constant in theCronTrigger
class.void
Specify the trigger's name.void
setPriority
(int priority) Specify the priority of this trigger.void
setStartDelay
(long startDelay) Set the start delay in milliseconds.void
setStartTime
(Date startTime) Set a specific start time for the trigger.void
setTimeZone
(TimeZone timeZone) Specify the time zone for this trigger's cron expression.
-
Constructor Details
-
CronTriggerFactoryBean
public CronTriggerFactoryBean()
-
-
Method Details
-
setName
Specify the trigger's name. -
setGroup
Specify the trigger's group. -
setJobDetail
Set the JobDetail that this trigger should be associated with. -
setJobDataMap
Set the trigger's JobDataMap. -
getJobDataMap
Return the trigger's JobDataMap. -
setJobDataAsMap
Register objects in the JobDataMap via a given Map.These objects will be available to this Trigger only, in contrast to objects in the JobDetail's data map.
- Parameters:
jobDataAsMap
- a Map with String keys and any objects as values (for example Spring-managed beans)
-
setStartTime
Set a specific start time for the trigger.Note that a dynamically computed
setStartDelay(long)
specification overrides a static timestamp set here. -
setStartDelay
public void setStartDelay(long startDelay) Set the start delay in milliseconds.The start delay is added to the current system time (when the bean starts) to control the start time of the trigger.
-
setCronExpression
Specify the cron expression for this trigger. -
setTimeZone
Specify the time zone for this trigger's cron expression. -
setCalendarName
Associate a specific calendar with this cron trigger. -
setPriority
public void setPriority(int priority) Specify the priority of this trigger. -
setMisfireInstruction
public void setMisfireInstruction(int misfireInstruction) Specify a misfire instruction for this trigger. -
setMisfireInstructionName
Set the misfire instruction via the name of the corresponding constant in theCronTrigger
class. Default isMISFIRE_INSTRUCTION_SMART_POLICY
. -
setDescription
Associate a textual description with this trigger. -
setBeanName
- Specified by:
setBeanName
in interfaceorg.springframework.beans.factory.BeanNameAware
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
ParseException
-
getObject
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<CronTrigger>
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<CronTrigger>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<CronTrigger>
-