Spring Batch3

Spring Batch TaskScheduler Example

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<h2><i>Why do we need scheduling&quest;<&sol;i><&sol;h2>&NewLine;<p>Scheduling is needed if you want to automate the repetition of a task at specific intervals or particular date&period; You could of course manually watch the time and execute your task&comma; albeit an inefficient task&period; Who wants to watch the computer every 10 seconds just to hit the Enter key&quest; No one&period;<&sol;p>&NewLine;<p><span style&equals;"text-align&colon; left&semi;">In this example we use a simple configuration and an example implementation of ItemReader and ItemWriter&comma; as you can see below&period; The Job is defined to run every 10 seconds&period; While everything works well in the first iteration&comma; reading and writing seems to be skipped in the subsequent iterations&period;<&sol;span><&sol;p>&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; left&semi;">&NewLine;<pre class&equals;"highlight">&lt&semi;batch&colon;job id&equals;"simpleDojJob" parent&equals;"simpleJob"&gt&semi; &NewLine; &lt&semi;batch&colon;step id&equals;"step1"&gt&semi; &NewLine; &lt&semi;batch&colon;tasklet&gt&semi; &NewLine; &lt&semi;batch&colon;chunk reader&equals;"xmlItemReader" writer&equals;"mongodbItemWriter" commit-interval&equals;"2" processor&equals;"employeeFilter"&sol;&gt&semi; &NewLine; &lt&semi;&sol;batch&colon;tasklet&gt&semi; &NewLine; &lt&semi;&sol;batch&colon;step&gt&semi; &NewLine; &lt&semi;&sol;batch&colon;job&gt&semi; &NewLine;&lt&semi;bean id&equals;"runScheduler" class&equals;"com&period;doj&period;batch&period;scheduler&period;RunScheduler" &sol;&gt&semi; &NewLine; &NewLine; &lt&semi;&excl;-- Run every 10 seconds --&gt&semi; &NewLine; &lt&semi;task&colon;scheduled-tasks&gt&semi; &NewLine; &lt&semi;task&colon;scheduled ref&equals;"runScheduler" method&equals;"run" cron&equals;"&ast;&sol;10 &ast; &ast; &ast; &ast; &ast;" &sol;&gt&semi; &NewLine; &lt&semi;&sol;task&colon;scheduled-tasks&gt&semi; &NewLine;<&sol;pre>&NewLine;<div id&equals;"ads-id" align&equals;"center"><&sol;div>&NewLine;<p>In this tutorial&comma; we will show you how to use Spring <b><i>TaskScheduler <&sol;i><&sol;b>to schedule a batch job to run every 5 seconds&period;<&sol;p>&NewLine;<h3><b>Tools and libraries used<&sol;b><&sol;h3>&NewLine;<ul style&equals;"text-align&colon; left&semi;">&NewLine;<li>Spring Tool Suite &lpar;STS&rpar;<&sol;li>&NewLine;<li>JDK 1&period;6<&sol;li>&NewLine;<li>Spring Core 3&period;2&period;2&period;RELEASE<&sol;li>&NewLine;<li>Spring OXM 3&period;2&period;2&period;RELEASE<&sol;li>&NewLine;<li>Spring Batch 2&period;2&period;0&period;RELEASE<&sol;li>&NewLine;<li>MongoDB Java Driver 2&period;7&period;3<&sol;li>&NewLine;<li>MongoDB 2&period;10&period;1<&sol;li>&NewLine;<&sol;ul>&NewLine;<h3><b>1&period; Project Directory Structure<&sol;b><&sol;h3>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2014&sol;03&sol;111&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<h3><b>2&period; Spring <i>TaskScheduler<&sol;i><&sol;b><&sol;h3>&NewLine;<p>Spring 3&period;0 introduces a TaskScheduler for scheduling tasks&period; It is part of the Spring-Core&comma; no need to declare an extra dependency&period; A scheduler triggers launch Spring Batch jobs&comma; by accessing the Spring Batch runtime&period;<&sol;p>&NewLine;<pre class&equals;"highlight">&lt&semi;&excl;-- Run every 10 seconds --&gt&semi; &NewLine; &lt&semi;task&colon;scheduled-tasks&gt&semi; &NewLine; &lt&semi;task&colon;scheduled ref&equals;"runScheduler" method&equals;"run" cron&equals;"&ast;&sol;10 &ast; &ast; &ast; &ast; &ast;" &sol;&gt&semi; &NewLine; &lt&semi;&sol;task&colon;scheduled-tasks&gt&semi; &NewLine; &lt&semi;task&colon;scheduled-tasks&gt&semi; &NewLine; &lt&semi;task&colon;scheduled ref&equals;"runScheduler" method&equals;"run" fixed-delay&equals;"10000" &sol;&gt&semi; &NewLine; &lt&semi;&sol;task&colon;scheduled-tasks&gt&semi; &NewLine;<&sol;pre>&NewLine;<p>The <i><b>TaskScheduler <&sol;b><&sol;i>will schedule to run below bean&period;<&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;doj&period;batch&period;scheduler&semi; &NewLine; &NewLine;import java&period;util&period;Date&semi; &NewLine; &NewLine;import org&period;springframework&period;batch&period;core&period;Job&semi; &NewLine;import org&period;springframework&period;batch&period;core&period;JobExecution&semi; &NewLine;import org&period;springframework&period;batch&period;core&period;JobParameters&semi; &NewLine;import org&period;springframework&period;batch&period;core&period;JobParametersBuilder&semi; &NewLine;import org&period;springframework&period;batch&period;core&period;launch&period;JobLauncher&semi; &NewLine;import org&period;springframework&period;beans&period;factory&period;annotation&period;Autowired&semi; &NewLine;import org&period;springframework&period;stereotype&period;Component&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;&commat;Component &NewLine;public class RunScheduler &lbrace; &NewLine; &commat;Autowired &NewLine; private JobLauncher jobLauncher&semi; &NewLine; &NewLine; &commat;Autowired &NewLine; private Job job&semi; &NewLine; &NewLine; public void run&lpar;&rpar; &lbrace; &NewLine; try &lbrace; &NewLine; String dateParam &equals; new Date&lpar;&rpar;&period;toString&lpar;&rpar;&semi; &NewLine; JobParameters param &equals; new JobParametersBuilder&lpar;&rpar;&period;addString&lpar;"date"&comma; dateParam&rpar;&period;toJobParameters&lpar;&rpar;&semi; &NewLine; System&period;out&period;println&lpar;dateParam&rpar;&semi; &NewLine; JobExecution execution &equals; jobLauncher&period;run&lpar;job&comma; param&rpar;&semi; &NewLine; System&period;out&period;println&lpar;"Exit Status &colon; " &plus; execution&period;getStatus&lpar;&rpar;&rpar;&semi; &NewLine; &rcub; catch &lpar;Exception e&rpar; &lbrace; &NewLine; &sol;&sol;e&period;printStackTrace&lpar;&rpar;&semi; &NewLine; &rcub; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<h3><b>Input XML File<&sol;b><br &sol;>&NewLine;<b>employees&period;xml<&sol;b><&sol;h3>&NewLine;<pre class&equals;"highlight">s&lt&semi;&quest;xml version&equals;"1&period;0" encoding&equals;"UTF-8"&quest;&gt&semi; &NewLine;&lt&semi;employees&gt&semi; &NewLine; &lt&semi;employee&gt&semi; &NewLine; &lt&semi;address&gt&semi;delhi&lt&semi;&sol;address&gt&semi; &NewLine; &lt&semi;age&gt&semi;37&lt&semi;&sol;age&gt&semi; &NewLine; &lt&semi;empid&gt&semi;1111&lt&semi;&sol;empid&gt&semi; &NewLine; &lt&semi;name&gt&semi;ATUL KUMAR&lt&semi;&sol;name&gt&semi; &NewLine; &lt&semi;salary&gt&semi;300000&period;0&lt&semi;&sol;salary&gt&semi; &NewLine; &lt&semi;&sol;employee&gt&semi; &NewLine; &lt&semi;employee&gt&semi; &NewLine; &lt&semi;address&gt&semi;delhi&lt&semi;&sol;address&gt&semi; &NewLine; &lt&semi;age&gt&semi;27&lt&semi;&sol;age&gt&semi; &NewLine; &lt&semi;empid&gt&semi;2222&lt&semi;&sol;empid&gt&semi; &NewLine; &lt&semi;name&gt&semi;Dinesh Rajput&lt&semi;&sol;name&gt&semi; &NewLine; &lt&semi;salary&gt&semi;60000&period;0&lt&semi;&sol;salary&gt&semi; &NewLine; &lt&semi;&sol;employee&gt&semi; &NewLine; &lt&semi;employee&gt&semi; &NewLine; &lt&semi;address&gt&semi;delhi&lt&semi;&sol;address&gt&semi; &NewLine; &lt&semi;age&gt&semi;31&lt&semi;&sol;age&gt&semi; &NewLine; &lt&semi;empid&gt&semi;3333&lt&semi;&sol;empid&gt&semi; &NewLine; &lt&semi;name&gt&semi;ASHUTOSH RAJPUT&lt&semi;&sol;name&gt&semi; &NewLine; &lt&semi;salary&gt&semi;400000&period;0&lt&semi;&sol;salary&gt&semi; &NewLine; &lt&semi;&sol;employee&gt&semi; &NewLine; &lt&semi;employee&gt&semi; &NewLine; &lt&semi;address&gt&semi;Kanpur&lt&semi;&sol;address&gt&semi; &NewLine; &lt&semi;age&gt&semi;27&lt&semi;&sol;age&gt&semi; &NewLine; &lt&semi;empid&gt&semi;4444&lt&semi;&sol;empid&gt&semi; &NewLine; &lt&semi;name&gt&semi;Adesh Verma&lt&semi;&sol;name&gt&semi; &NewLine; &lt&semi;salary&gt&semi;80000&period;0&lt&semi;&sol;salary&gt&semi; &NewLine; &lt&semi;&sol;employee&gt&semi; &NewLine; &lt&semi;employee&gt&semi; &NewLine; &lt&semi;address&gt&semi;Noida&lt&semi;&sol;address&gt&semi; &NewLine; &lt&semi;age&gt&semi;37&lt&semi;&sol;age&gt&semi; &NewLine; &lt&semi;empid&gt&semi;5555&lt&semi;&sol;empid&gt&semi; &NewLine; &lt&semi;name&gt&semi;Dinesh Rajput&lt&semi;&sol;name&gt&semi; &NewLine; &lt&semi;salary&gt&semi;300000&period;0&lt&semi;&sol;salary&gt&semi; &NewLine; &lt&semi;&sol;employee&gt&semi; &NewLine;&lt&semi;&sol;employees&gt&semi; &NewLine;<&sol;pre>&NewLine;<p><b>Employee&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;doj&period;batch&period;bean&semi; &NewLine; &NewLine;import javax&period;xml&period;bind&period;annotation&period;XmlRootElement&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;&commat;XmlRootElement&lpar;name&equals;"employee"&rpar; &NewLine;public class Employee &lbrace; &NewLine; private int empid&semi; &NewLine; private String name&semi; &NewLine; private int age&semi; &NewLine; private float salary&semi; &NewLine; private String address&semi; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the empid &NewLine; &ast;&sol; &NewLine; public int getEmpid&lpar;&rpar; &lbrace; &NewLine; return empid&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param empid the empid to set &NewLine; &ast;&sol; &NewLine; public void setEmpid&lpar;int empid&rpar; &lbrace; &NewLine; this&period;empid &equals; empid&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the name &NewLine; &ast;&sol; &NewLine; public String getName&lpar;&rpar; &lbrace; &NewLine; return name&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param name the name to set &NewLine; &ast;&sol; &NewLine; public void setName&lpar;String name&rpar; &lbrace; &NewLine; this&period;name &equals; name&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the age &NewLine; &ast;&sol; &NewLine; public int getAge&lpar;&rpar; &lbrace; &NewLine; return age&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param age the age to set &NewLine; &ast;&sol; &NewLine; public void setAge&lpar;int age&rpar; &lbrace; &NewLine; this&period;age &equals; age&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the salary &NewLine; &ast;&sol; &NewLine; public float getSalary&lpar;&rpar; &lbrace; &NewLine; return salary&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param salary the salary to set &NewLine; &ast;&sol; &NewLine; public void setSalary&lpar;float salary&rpar; &lbrace; &NewLine; this&period;salary &equals; salary&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the address &NewLine; &ast;&sol; &NewLine; public String getAddress&lpar;&rpar; &lbrace; &NewLine; return address&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param address the address to set &NewLine; &ast;&sol; &NewLine; public void setAddress&lpar;String address&rpar; &lbrace; &NewLine; this&period;address &equals; address&semi; &NewLine; &rcub; &NewLine; &NewLine; public String toString&lpar;&rpar;&lbrace; &NewLine; return "Name- "&plus;name&plus;" Age- "&plus;age&plus;" salary- "&plus;salary&plus;" address "&plus;address&semi; &NewLine; &rcub; &NewLine; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<h3><strong>4&period; Job configuration<&sol;strong><br &sol;>&NewLine;simple-job&period;xml<&sol;h3>&NewLine;<pre class&equals;"highlight">&lt&semi;&quest;xml version&equals;"1&period;0" encoding&equals;"UTF-8"&quest;&gt&semi; &NewLine;&lt&semi;beans xmlns&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;beans" &NewLine; xmlns&colon;context&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;context" &NewLine; xmlns&colon;p&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;p" &NewLine; xmlns&colon;task&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;task" &NewLine; xmlns&colon;batch&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;batch" &NewLine; xmlns&colon;mvc&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;mvc" &NewLine; xmlns&colon;xsi&equals;"http&colon;&sol;&sol;www&period;w3&period;org&sol;2001&sol;XMLSchema-instance" &NewLine; xsi&colon;schemaLocation&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;beans &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;beans&sol;spring-beans-4&period;0&period;xsd &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;context &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;context&sol;spring-context-4&period;0&period;xsd &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;mvc &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;mvc&sol;spring-mvc-4&period;0&period;xsd &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;batch &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;batch&sol;spring-batch-2&period;0&period;xsd &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;task &NewLine;http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;task&sol;spring-task-3&period;2&period;xsd"&gt&semi; &NewLine; &lt&semi;context&colon;component-scan base-package&equals;"com&period;doj&period;batch" &sol;&gt&semi; &NewLine; &lt&semi;import resource&equals;"applicationContext&period;xml"&sol;&gt&semi; &NewLine; &lt&semi;import resource&equals;"mongodbConfig&period;xml"&sol;&gt&semi; &NewLine; &NewLine; &lt&semi;bean id&equals;"xmlItemReader" class&equals;"org&period;springframework&period;batch&period;item&period;xml&period;StaxEventItemReader"&gt&semi; &NewLine; &lt&semi;property name&equals;"resource" value&equals;"classpath&colon;xml&sol;employees&period;xml" &sol;&gt&semi; &NewLine; &lt&semi;property name&equals;"unmarshaller" ref&equals;"empUnMarshaller" &sol;&gt&semi; &NewLine; &lt&semi;property name&equals;"fragmentRootElementName" value&equals;"employee" &sol;&gt&semi; &NewLine; &lt&semi;&sol;bean&gt&semi; &NewLine; &lt&semi;bean id&equals;"empUnMarshaller" class&equals;"org&period;springframework&period;oxm&period;jaxb&period;Jaxb2Marshaller"&gt&semi; &NewLine; &lt&semi;property name&equals;"classesToBeBound"&gt&semi; &NewLine; &lt&semi;value&gt&semi;com&period;doj&period;batch&period;bean&period;Employee&lt&semi;&sol;value&gt&semi; &NewLine; &lt&semi;&sol;property&gt&semi; &NewLine; &lt&semi;&sol;bean&gt&semi; &NewLine; &lt&semi;&excl;-- write it to MongoDB&comma; 'employee' collection &lpar;table&rpar; --&gt&semi; &NewLine; &lt&semi;bean id&equals;"mongodbItemWriter" class&equals;"org&period;springframework&period;batch&period;item&period;data&period;MongoItemWriter"&gt&semi; &NewLine; &lt&semi;property name&equals;"template" ref&equals;"mongoTemplate" &sol;&gt&semi; &NewLine; &lt&semi;property name&equals;"collection" value&equals;"employee" &sol;&gt&semi; &NewLine; &lt&semi;&sol;bean&gt&semi; &NewLine; &NewLine; &lt&semi;bean id&equals;"employeeFilter" class&equals;"com&period;doj&period;batch&period;process&period;EmployeeFilter"&gt&semi;&lt&semi;&sol;bean&gt&semi; &NewLine; &NewLine; &lt&semi;batch&colon;job id&equals;"simpleDojJob" parent&equals;"simpleJob"&gt&semi; &NewLine; &lt&semi;batch&colon;step id&equals;"step1"&gt&semi; &NewLine; &lt&semi;batch&colon;tasklet&gt&semi; &NewLine; &lt&semi;batch&colon;chunk reader&equals;"xmlItemReader" writer&equals;"mongodbItemWriter" commit-interval&equals;"2" processor&equals;"employeeFilter"&sol;&gt&semi; &NewLine; &lt&semi;&sol;batch&colon;tasklet&gt&semi; &NewLine; &lt&semi;&sol;batch&colon;step&gt&semi; &NewLine; &lt&semi;&sol;batch&colon;job&gt&semi; &NewLine; &NewLine; &lt&semi;bean id&equals;"runScheduler" class&equals;"com&period;doj&period;batch&period;scheduler&period;RunScheduler" &sol;&gt&semi; &NewLine; &NewLine; &lt&semi;&excl;-- Run every 10 seconds --&gt&semi; &NewLine; &lt&semi;task&colon;scheduled-tasks&gt&semi; &NewLine; &lt&semi;task&colon;scheduled ref&equals;"runScheduler" method&equals;"run" cron&equals;"&ast;&sol;10 &ast; &ast; &ast; &ast; &ast;" &sol;&gt&semi; &NewLine; &lt&semi;&sol;task&colon;scheduled-tasks&gt&semi; &NewLine;&lt&semi;&sol;beans&gt&semi; &NewLine;<&sol;pre>&NewLine;<h3><b>Run It-<&sol;b><&sol;h3>&NewLine;<p>Loads the Spring application context&comma; the scheduler will be run automatically&period;<br &sol;>&NewLine;<b>TestBatch&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;doj&period;batch&period;test&semi; &NewLine; &NewLine;import org&period;springframework&period;context&period;ApplicationContext&semi; &NewLine;import org&period;springframework&period;context&period;support&period;ClassPathXmlApplicationContext&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;public class TestBatch &lbrace; &NewLine; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param args &NewLine; &ast;&sol; &NewLine; public static void main&lpar;String&lbrack;&rsqb; args&rpar; &lbrace; &NewLine; ApplicationContext context &equals; new ClassPathXmlApplicationContext&lpar;"simple-job&period;xml"&rpar;&semi; &NewLine; &rcub; &NewLine; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p><b>Output&comma; it insert the xml content every 10 seconds in mongodb&period;<&sol;b><&sol;p>&NewLine;<p><i>&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;<&sol;i><br &sol;>&NewLine;<i>&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&period;&period;<&sol;i><br &sol;>&NewLine;<i>Mar 9&comma; 2014 5&colon;43&colon;18 PM org&period;springframework&period;oxm&period;jaxb&period;Jaxb2Marshaller createJaxbContextFromClasses<&sol;i><br &sol;>&NewLine;<i>INFO&colon; Creating JAXBContext with classes to be bound &lbrack;class com&period;doj&period;batch&period;bean&period;Employee&rsqb;<&sol;i><br &sol;>&NewLine;<i>Sun Mar 09 17&colon;43&colon;20 IST 2014<&sol;i><br &sol;>&NewLine;<i>Mar 9&comma; 2014 5&colon;43&colon;20 PM org&period;springframework&period;batch&period;core&period;launch&period;support&period;SimpleJobLauncher&dollar;1 run<&sol;i><br &sol;>&NewLine;<i>INFO&colon; Job&colon; &lbrack;FlowJob&colon; &lbrack;name&equals;simpleDojJob&rsqb;&rsqb; launched with the following parameters&colon; &lbrack;&lbrace;date&equals;Sun Mar 09 17&colon;43&colon;20 IST 2014&rcub;&rsqb;<&sol;i><br &sol;>&NewLine;<i>Mar 9&comma; 2014 5&colon;43&colon;20 PM org&period;springframework&period;batch&period;core&period;job&period;AbstractJob handleStep<&sol;i><br &sol;>&NewLine;<i>INFO&colon; Executing step&colon; &lbrack;TaskletStep&colon; &lbrack;name&equals;step1&rsqb;&rsqb;<&sol;i><br &sol;>&NewLine;<i>Name- ATUL KUMAR Age- 37 salary- 300000&period;0 address delhi<&sol;i><br &sol;>&NewLine;<i>Mar 9&comma; 2014 5&colon;43&colon;20 PM org&period;springframework&period;oxm&period;jaxb&period;Jaxb2Marshaller processSource<&sol;i><br &sol;>&NewLine;<i>Name- ASHUTOSH RAJPUT Age- 31 salary- 400000&period;0 address delhi<&sol;i><br &sol;>&NewLine;<i>Mar 9&comma; 2014 5&colon;43&colon;20 PM org&period;springframework&period;oxm&period;jaxb&period;Jaxb2Marshaller processSource<&sol;i><br &sol;>&NewLine;<i>Name- Dinesh Rajput Age- 37 salary- 300000&period;0 address Noida<&sol;i><br &sol;>&NewLine;<i>Exit Status &colon; COMPLETED<&sol;i><br &sol;>&NewLine;<i>Mar 9&comma; 2014 5&colon;43&colon;20 PM org&period;springframework&period;batch&period;core&period;launch&period;support&period;SimpleJobLauncher&dollar;1 run<&sol;i><br &sol;>&NewLine;<i>INFO&colon; Job&colon; &lbrack;FlowJob&colon; &lbrack;name&equals;simpleDojJob&rsqb;&rsqb; completed with the following parameters&colon; &lbrack;&lbrace;date&equals;Sun Mar 09 17&colon;43&colon;20 IST 2014&rcub;&rsqb; and the following status&colon; &lbrack;COMPLETED&rsqb;<&sol;i><br &sol;>&NewLine;<i>Sun Mar 09 17&colon;43&colon;30 IST 2014<&sol;i><br &sol;>&NewLine;<i>&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&period;<&sol;i><br &sol;>&NewLine;<i>&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;&&num;8230&semi;<&sol;i><&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2014&sol;03&sol;111-1&period;png" border&equals;"0" &sol;><&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<h2><b>Download Source Code with Jars<&sol;b><br &sol;>&NewLine;<b><a href&equals;"https&colon;&sol;&sol;sites&period;google&period;com&sol;a&sol;dineshonjava&period;com&sol;dineshonjava&sol;dineshonjava&sol;SpringBatchTaskSchedulerExample&period;zip&quest;attredirects&equals;0&amp&semi;d&equals;1" target&equals;"&lowbar;blank" rel&equals;"noopener">SpringBatchTaskSchedulerExample&period;zip<&sol;a><&sol;b><&sol;h2>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"text-align&colon; center&semi;"><b>&lt&semi;&lt&semi;<a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;multiresourceitemreader-in-spring-batch&sol;">Previuos<&sol;a>&lt&semi;&lt&semi; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-tutorial&sol;">Index <&sol;a>&gt&semi;&gt&semi; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-batch-taskscheduler-example&sol;">Next<&sol;a>&gt&semi;&gt&semi;<&sol;b><&sol;div>&NewLine;<&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;multiresourceitemreader-in-spring-batch&sol;">Previous<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-application-context-provider&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '220'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design PatternsĀ using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago