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 @   搬砖的孟达  阅读(11)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示