Change job in spring mvc by read and write xml file

Thursday, August 25th, 2016 (0 Comment)

We will use quartz library to create two job and change job in Spring mvc. These job will load scheduler job information from xml file.

The first job will run every 5 second  and “output text is Job 1 is running”, the second job will run every 10 second and “output text is Job 2 is running”.

After that, we input on page to change second to these job and save result into xml file.

1) At first, we create project change job in spring as below:

spring job xml

spring job xml

We create scheduler.xml file to save information of jobs

2) Config for change job in spring project

pom.xml : maven config

servlet-context.xml

servlet-quartz.xml

web.xml

3) Java files of change job in spring mvc project

EntityJob.java: information of job

Wrapper.java: get all information from scheduler.xml file

BindXml.java: class to read and write change job in spring into scheduler.xml file

utils.java: format job information

Job1.java: execute job 1

Job2.java: execute job 2

JobListener.java: listening job when start start server (start quartz job)

JobSchedulerHandle.java: handle quartz job as change job in spring and storing into scheduler.xml file or load information of job from scheduler.xml file.

HelloWorldController.java: controller to manage on page screen

4) Pages screen to change job in spring

hello.jsp

index.jsp

Output:

After change job 2 to 0/5 =job 2 will run  every 5 second 

 

Tags: , , , , ,

Related Posts

spring
How to create quartz spring dynamic in database
spring
Spring mvc mongodb crud users roles
spring
Java spring mvc tutorial on lvtutorial.com
spring
Angularjs spring mvc crud example

Related Posts

spring
How to create quartz spring dynamic in database
spring
Spring mvc mongodb crud users roles
spring
Java spring mvc tutorial on lvtutorial.com
spring
Angularjs spring mvc crud example

Leave a Reply

Your email address will not be published. Required fields are marked *