quartz + spring 配置示例
阿新 • • 發佈:2017-06-16
spring rop expr odi 配置 分鐘 每分鐘 定時任務 div
<!-- 配置job定時任務類 --> <bean id="triggerCalculateLecturerProfitJob" class="com.itzixi.quartz.job.CalculateLecturerProfitJob"></bean> <!-- 配置jobDetail --> <bean id="triggerCalculateLecturerProfitJobMethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject"> <ref bean="triggerCalculateLecturerProfitJob"/> </property> <!-- 要執行triggerCalculateLecturerProfitJob的方法的名稱 --> <property name="targetMethod"> <value>execute</value> </property> </bean> <!-- 配置定時任務觸發器trigger --> <bean id="triggerCalculateLecturerProfitJobFactoryBean" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="triggerCalculateLecturerProfitJobMethod"></property> <!-- 用於測試,每分鐘跑一次 --> <!-- <property name="cronExpression" value="0 0/1 * * * ?"></property> --> <!-- 每晚淩晨1點跑 --> <property name="cronExpression" value="0 0 1 * * ? *"></property> </bean> <!-- 配置調度工廠 --> <bean id="springJobSchedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="triggerCalculateLecturerProfitJobFactoryBean"/> </list> </property> </bean>
quartz + spring 配置示例