This project builds on the example from https://spring.io/guides/gs/batch-processing/
It uses a csv file (1000 records generated by mockaroo.com of first and last names) as the source file.
Note that the source file for this project is located in the /resources (i.e. the same location as application.properties)
A logger is used to indicate the status of the job.
The destination is a MYSQL database. For each record, the data is converted to upper case and then stored.
This example modifies the spring batch processing guide as follows:
- Adds @Entity annotation to the Person object, so that data can be stored to the database
- Adds a PersonRepository to establish a connection to the database
- Adds a RepositoryWriterItem repoWriter method, which allows data that is read from the csv (using the reader method) to be saved to the database.
- In the repoWriter method, the an instance of the PersonRepository is defined, and the operation to be performed is selected by using the setMethodName() method.
- Clone the project
- Create a database / schema called springbatchtest
- Run the project