This post was last edited by Jacktang on 2018-7-7 15:49 Often, we need to let the system automatically execute a piece of code to execute business-related logic. For example, for birthday SMS notification, we need a scheduled task to obtain all users on their birthdays, and then execute SMS push and other business logic. How does Jfinal implement scheduled task scheduling? Step 1: Add your own jfinal plugin interface class configuration to the configPlugin method in the Jfinal filter. public void configPlugin(Plugins me){ QuartzPlugin plugin = new QuartzPlugin("job.properties"); me.add(plugin); //...Data source and other other configurations. The code of the QuartzPlugin class is as follows: import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.Properties; import org.apache.log4j.Logger; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; import org.quartz.Job; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SchedulerFactory; SchedulerFactory; import com.jfinal.plugin.IPlugin; public class QuartzPlugin implements IPlugin { private final Logger logger = Logger.getLogger(QuartzPlugin.class); private static final String JOB = "job"; private String config = "job.properties"; private Properties properties; public QuartzPlugin(String config) { this.config = config; } public QuartzPlugin() { } private SchedulerFactory schedulerF actory; private Scheduler scheduler; @SuppressWarnings("unchecked") public boolean start() { try { loadProperties(); } catch (IOException e) { logger.error(e.getMessage()); return false; } if (properties == null) { return false; } schedulerFactory = new StdSchedulerFactory(); try { scheduler = schedulerFactory.getScheduler(); } catch (Sch edulerException e) { logger.error(e.getMessage()); return false; } if (scheduler == null) { logger.error("scheduler is null"); return false; } Enumeration