标签:
在spring读取bean 的配置文件中配置如下
<bean id="beanScheduler" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<bean id="work1"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="xxx" />//定时任务的类注册的beanid
<property name="targetMethod" value="XXX" />//引用bean的某个方法
</bean>
</property>
<property name="cronExpression" value="0 0 4 * * ?" />//方法执行时间
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
lazy-init="false" autowire="no">
<property name="triggers">
<list>
<ref bean="beanScheduler"/>
</list>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.jobStore.class">
org.quartz.simpl.RAMJobStore
</prop>
</props>
</property>
</bean>
标签:
原文地址:http://blog.csdn.net/colorsunlight/article/details/45028045