Jfinal中配置定时任务Quartz1.configPlunin配置:@Override public void configPlugin(Plugins plugins) { QuartzPlugin cleanTask = new QuartzPlugin("clean.properties"); plugins.add(cleanTask); }2.clean.properties配置:a.job=com.ninemax.schedule.CleanFile //定时任务指定的程序代码,实现job接口,业务代码在execute()方法中执行a.cron=0 0 0 1 * ? //定时时间a.enable=true //是否启用3.执行方法:package com.ninemax.schedule;import java.io.File;import java.io.FileFilter;import org.quartz.Job;import org.quartz.JobExecutionContext;import org.quartz.JobExecutionException;import com.jfinal.kit.PathKit;/** * 用于清理系统上传文件中的文件 * * @author ninemax-jzh * */public class CleanFile implements Job { @Override public void execute(JobExecutionContext context)throws JobExecutionException { String webRootPath = PathKit.getWebRootPath(); File uploadDir = new File(webRootPath, "upload"); if (uploadDir.exists() && uploadDir.isDirectory()) { File[] files = uploadDir.listFiles(new FileFilter() { @Override public boolean accept(File file) { return !file.isDirectory(); } }); if (files != null && files.length != 0) { for (File file : files) { file.delete(); } } } }}