Monday, September 8, 2014

Developing first spring batch job


Time needed to complete  ~45 minutes
Prerequisite for this tutorial is Configure Spring Batch Admin to use MySQL

1.Introduction


After configuring Spring Batch Admin project now it is time to write first batch job and run it in eclipse, then run the job from Spring Batch Admin web application. The application is simple, reading from csv file and writing to database table.


2.What is used in this tutorial:


1- Maven 3
2- Jdk 1.7
3- Tomcat 7.0.55
4- Eclipse Luna 4.4
5- Spring Core 3.2.9
6- Spring Batch 2.2.7
7- Spring Batch Admin Manager 1.3.0
8- MySQL 5 Database


3.Project Structure


4. Configuration  files

- The database configuration where the data will be wiritten is in file database.xml path springBatchAdminTC2/src/main/resources/META-INF/spring/batch/dbConfig/database.xml, this
is not the same as the database used for spring batch admin to store job repository data. First create the database named company_db and in the database.xml change db_username and db_password to suite company_db username and password.

- The data while be written in tel_order table, the DDL for creating tel_order is in file src/main/resources/tel_order_ddl.sql

No comments:

Post a Comment