Learn to use Spring batch to read records from CSV file and insert into database using JdbcBatchItemWriter. I am using embedded database H2 to demo this example.
Learn to use ItemStream and ChunkListener to count number of records processed by Spring batch job and log the record count in logs file or console.
Learn to use ItemProcessor to add business logic after reading the input and before passing it to writer for writing to the file/database. It should be noted that while it’s possible to return a different datatype than the one provided as input, it’s not necessary. Returning null from ItemProcessor indicates that the item should not […]
In Spring batch jobs, the best approach to delete the flat files after read or processing is to create separate Tasklet and execute it at the end of job, when processing is complete. Tasklet for deleting files This is an example of such Tasklet which will delete all CSV files from c:/temp/input/ location at the […]
Learn to write CSV data using FlatFileItemWriter. It is an item writer that writes data to a file or stream. The location of the output file is defined by a Resource and must represent a writable file.