浏览 1460 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (17) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-07-02
Quartz has the notion of four entities:a Job, and a JobDetail, a Trigger, a Scheduler. job: <bean id="testService" class="test.TestService" > </bean> <!--Quartz jobs are not persisted by default. You need to implement the StatefulJob interface to have your jobs persisted between executions and between system restarts--> JobDetail: <bean id="testJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" scope="prototype"> <property name="targetObject"> <ref bean="testService" /> </property> <property name="targetMethod"> <value>oneMethodInTestService</value> </property> <property name="concurrent"> <!--enforce that multiple instances of the job will not be executed concurrently--> <value>false</value> </property> </bean> Trigger: <bean id="testTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="testJobDetail" /> </property> <property name="cronExpression"> <!--execution timing --> <value>0/5 * * * * ?</value> </property> </bean> Scheduler: <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="schedulerName" value="timesQuartz" /> <property name="autoStartup" value="true" /> <property name="triggers"> <list> <ref bean="testTrigger"/> </list> </property> </bean> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |