Spring integrates the simple configuration method of quartz
•
Java
However, it is rarely used directly in practical work. Spring quartz components are usually used, which can be automatically assembled by the spring framework through configuration. The following is the method for the spring framework to integrate quartz components and configure scheduled tasks
1. Maven dependence
Among them, quartz package is the core package, which is responsible for realizing timing tasks; The spring context support package contains spring's integration tools for quartz
2. Spring configuration
Spring's Quartz configuration consists of four steps:
The above is an example of a task calling a basic method and a timed task triggered based on a cron expression. In fact, this mode is mostly used in Java Web projects
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码