Now that we have illustrated what Spring Batch is, we are going to implement the payroll file processing use case (as defined in the previous section) through the following steps:
- Coding a process that imports payroll data from a CSV spreadsheet
- Transforming the file tuples with a business class
- Storing the results in a database
The following diagram illustrates our implementation:
First, we are going to create a new, clean project, using the Spring initializer (https://start.spring.io), as we did in the previous section:
Don't forget to add a database driver as a dependency in the pom.xml
file. For testing purposes, we are going to use HSQL (http://hsqldb.org/), as follows:
<dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <scope>runtime</scope> </dependency>