Scheduler timing Scheduling system is required for most industry projects, the traditional spring-job mode, the personal feeling has been out, because there are a lot of problems, especially the timing of the addition of scheduling, modification, deletion, need to modify the XML, XML configuration in effect is nothing more than a hot deployment of gray-scale publishing scheme or directly stop, restart the server, completely can not do automatic startup, repair mode.
Reminder: The application can be deployed in a cluster, in the timing of scheduling configuration can use cluster mode or unilateral configuration application, today is the use of Spring4+scheduler to implement timing scheduling, gossip less, directly to the steps recorded:
1. In the project's Pom.xml file, introduce the Quartz jar package as follows:
Java code
Lt;dependency>
Org.quartz-scheduler
Quartz
1.8.5
Lt;/dependency>
2. Define the Quartz configuration file Spring-context-quartz.xml:
Java code
xmlns:context= "Http://www.springframework.org/schema/context" xsi:schemalocation= "
Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd "
Default-lazy-init= "false" >
3. Introduction of the Spring-context-quartz.xml configuration file in the project's Web. xml file
Java code
4. Defining the Job Entity object
Java code
5. Write the Jobservvice class for Quartz:
Java code
6. Writing related job Controller, DAO, Dao.xml I will not write on this side, in fact, the data to delete and change the operation
7. Start the project to verify that the quartz is successful:
Project launches a console:
Willing to understand the framework of technology or source of friends directly seeking exchange sharing technology: 2042849237
Some of the distributed solutions, the friends who are willing to know can find our team to discuss
More detailed source code reference: Http://minglisoft.cn/technology
Spring4+springmvc+quartz realization of multi-thread dynamic timing scheduling
Spring4+springmvc+quartz realization of multi-thread dynamic timing scheduling