jfinal配置Quartz

在JfinalConfig中添加QuartzPlugin   (导包为:import cn.dreampie.quartz.QuartzPlugin;)

//定时任务插件
QuartzPlugin quartzPlugin = new QuartzPlugin();
quartzPlugin.setJobs("quartzJob.properties");
plugins.add(quartzPlugin);
quartzPlugin.start();

quartzJob.properties:

job.channel.class=com.jfinalshop.service.TaskTimer.QuartzJobService
job.channel.group=default
job.channel.id=1
job.channel.cron=0 30 16 * * ? 
job.channel.enable =true

QuartzJobService:

public class QuartzJobService implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        System.out.println("疯狂的在执行了"+System.currentTimeMillis());
        
    }


}
在excute()中设定你的定时业务.



posted @ 2022-10-18 16:13  搬砖的孟达  阅读(23)  评论(0)    收藏  举报  来源