java定时任务不会执行

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">








<bean id="monitorStartJob" class="org.springframework.scheduling.quartz.JobDetailBean">
    <property name="jobClass">
        <value>com.jovtec.galaxy.sitemonitor.boot.MonitorStartTask</value>
    </property>
</bean>
<bean id="monitorStartJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
    <property name="jobDetail">
        <ref bean="monitorStartJob" />
    </property>
    <property name="cronExpression">
        <value>0/5 * * * * ?</value>
        <!--  <value>0 0 1 * * ?</value>-->
    </property>
</bean>

package com.jovtec.galaxy.sitemonitor.boot;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;
import org.springframework.scheduling.quartz.QuartzJobBean;

@SuppressWarnings("deprecation")
public class MonitorStartTask extends QuartzJobBean implements StatefulJob{

@Override
protected void executeInternal(JobExecutionContext paramJobExecutionContext)
        throws JobExecutionException {
    MonitorStart ms=new MonitorStart();
    System.out.println("++++++++++++++++++++++++++++++++++++++++++++++定时任务");
    ms.Start();

}

}

1个回答

你没启动Scheduler吧


加微信214710841

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问