Java Reference
In-Depth Information
<bean name="documentReplicationJob"
<property name="jobClass"
value="com.apress.springenterpriserecipes.replicator.FileReplicationJob" />
<property name="jobDataAsMap">
<entry key="fileReplicator" value-ref="documentReplicator" />
Spring also offers MethodInvokingJobDetailFactoryBean for you to define a job that executes a
single method of a particular object. This saves you the trouble of creating a job class. You can use the
following job detail to replace the previous:
<bean id="documentReplicationJob" class="org.springframework.
<property name="targetObject" ref="documentReplicator" />
<property name="targetMethod" value="replicate" />
You can configure a Quartz SimpleTrigger object in Spring's bean configuration file through
SimpleTriggerBean , which requires a reference to a JobDetail object. This bean provides common
default values for certain trigger properties, such as using the bean name as the job name, setting
indefinite repeat count, and so on.
<bean id="documentReplicationTrigger"
<property name="jobDetail" ref="documentReplicationJob" />
<property name="repeatInterval" value="60000" />
<property name="startDelay" value="5000" />
You can also configure a Quartz CronTrigger object in the bean configuration file through
CronTriggerBean .
<bean id="documentReplicationTrigger"
<property name="jobDetail" ref="documentReplicationJob" />
<property name="cronExpression" value=" 0 * * * * ? " />
Finally, you can configure a SchedulerFactoryBean instance to create a Scheduler object for running
your trigger. You can specify multiple triggers in this factory bean.
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<ref bean="documentReplicationTrigger" />
<!-- other triggers you have may be included here -->
Search WWH ::

Custom Search