spring-quartz(定时器)问题
大侠指点下,就是找不到出错误的原因
lib/spring.jar ,quartz-all-1.6.1-RC1.jar,log4j-1.2.14.jar(使用MyEeclipse6.5)
java 代码
package com.fly.quartz;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
public class SayHelloTaskUsingQuartz extends QuartzJobBean {
protected void executeInternal(JobExecutionContext context)
throws JobExecutionException {
System.out.println("---------SayHelloTaskUsingQuartz.executeInternal()-----------");
}
}
application.xml
<beans>
<!-- spring定时器配置 begin -->
<bean name="exampleJob"
class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass"
value="com.fly.quartz.SayHelloTaskUsingQuartz" />
</bean>
<!-- 关键在如下两个触发器的配置 -->
<!-- 类似于Java的简单触发器 -->
<bean id="helloTrigger"
class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail">
<ref bean="exampleJob" />
</property>
<property name="startDelay">
<value>1000</value>
</property>
<property name="repeatInterval">
<value>3000</value>
</property>
</bean>
<!-- 复杂触发器
<bean id="helloCronTrigger"
class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<ref bean="sayHelloJob" />
</property>
<property name="cronExpression">
关键在配置此表达式
<value>0 49 15 * * ?</value>
</property>
</bean>
<bean id="scheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<ref bean="helloCronTrigger" />
</property>
</bean>-->
<!-- spring定时器配置 end -->