Spring4+springmvc+quartz realization of multi-thread dynamic timing scheduling

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.