Spring-Batch Tutorial Getting Started Guide
Agenda Software prerequisites Creating new batch application Setting up database Running a job
Prerequisites JDK 1.4 or later Maven 2
Checkout & install the framework svn checkout springframework.svn.sourceforge.net/ svnroot/springframework/ spring-batch/trunk spring-batch cd spring-batch mvn install
Download & Install framework Download snapshot from batch/snapshots.html Manually install to local maven repository: mvn install:install-file -DgroupId=org.springframework.batch -DartifactId=spring-batch-execution -Dversion=M3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Create a batch application Use the spring-batch-app archetype mvn archetype:create -DarchetypeGroupId=org.springframework.batch -DarchetypeArtifactId=spring-batch-app -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.myorganization -DartifactId=my-app-name
Setup the database Create a schema using SQL script from /src/main/resources/db-schema-scripts Edit JDBC connection properties in /src/main/resource/batch-jdbc.properties
Run a job cd path/to/my-app-name mvn test mvn exec:exec
Look behind the curtains src/main/resources/helloWorldJob.xml contains the job configuration pom.xml contains the maven’s exec plugin configuration which launches the job with appropriately configured classpath