标签:blog http io ar art html log sp on
以优惠券即将到期的提醒为例
<!-- 优惠券即将到期的提醒 start-->
<bean id="overdueRemindJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="couponManagerImpl"/>
<property name="targetMethod">
<value>overdueRemind</value>
</property>
<!--将并发设置为false-->
<property name="concurrent">
<value>false</value>
</property>
</bean>
<bean id="overdueRemindTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean ="overdueRemindJob" />
</property>
<!-每天早上5点触发-->
<property name="cronExpression">
<value>0 0 5 * * ?</value>
</property>
</bean>
<!-- 优惠券即将到期提醒 end -->
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
lazy-init="false" autowire="no" >
<property name="triggers">
<list>
<ref local="overdueRemindTrigger"/>
</list>
</property>
</bean>
</property>
</bean>
这里的Job为无参数的方法,里面包含处理逻辑。
调度触发器有两种配置方式具体可参照
http://www.cnblogs.com/obullxl/archive/2011/07/10/spring-quartz-cron-integration.html
标签:blog http io ar art html log sp on
原文地址:http://www.cnblogs.com/list1988/p/3927520.html