读书人

quartz spring 容易用法

发布时间: 2012-08-26 16:48:06 作者: rapoo

quartz spring 简单用法

    <bean id="emailCustomizeJob" />        </property>        <!-- 调用类中的方法 -->        <property name="targetMethod">            <value>emailCustomizeJob</value>        </property>    </bean>    <!-- 定义触发时间 -->    <bean id="emailCustomizeJobTrigger" />        </property>        <!-- cron表达式 -->        <property name="cronExpression">        <!-- 每三分钟,触发一次。 -->            <value>0/3 * * * * ?</value>        </property>    </bean>    <!-- 启动定时任务  --><bean ref="dataSource" /><property name="applicationContextSchedulerContextKey" value="applicationContextKey" /><property name="configLocation" value="classpath:quartz.properties" /><property name="globalTriggerListeners"><list><ref bean="globleLogListener" /></list></property><property name="triggers"><list><!-- 邮件定制通知作业 --><ref bean="emailCustomizeJobTrigger"/></list></property></bean>

?

SchedulerFactoryBean 为返回的为Scheduler

以上quartz保存在数据库中。

?

org.quartz.scheduler.instanceName = quartzSchedulerorg.quartz.scheduler.rmi.export = falseorg.quartz.scheduler.rmi.proxy = falseorg.quartz.scheduler.wrapJobExecutionInUserTransaction = falseorg.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPoolorg.quartz.threadPool.threadCount = 10org.quartz.threadPool.threadPriority = 5org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = trueorg.quartz.jobStore.misfireThreshold = 60000#org.quartz.jobStore.class = org.quartz.simpl.RAMJobStoreorg.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate#org.quartz.jobStore.driverDelegateClass=org.quartz.implbcjobstore.StdJDBCDelegateorg.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate#org.quartz.jobStore.useProperties = trueorg.quartz.jobStore.tablePrefix = QRTZ_org.quartz.jobStore.isClustered = false  org.quartz.jobStore.maxMisfiresToHandleAtATime=1

?

以上是quartz结合spring的简单应用。

?

读书人网 >软件架构设计

热点推荐