I have requirement where
- I need to upload a csv file (having close to 500k-1Million records)
- parse the file and do some validations
- build parent-child relationship based on data
- save it to Database.
I was using Springboot Multipart to upload the file (step 1 is done) but for rest the process(step 2,3 & 4), I wanted to use Spring Batch and has bunch of questions using it.
When I looked into using Spring Batch, all the examples I find are simply
- loading the file from memory, processing and writing to DB and besides that all the Spring Batch classes are sitting in Configuration folder as beans.
How do I pass the file from controller to FlatFileItemReader -> then to ItemProcessor to do some validations/processing/massaging-data -> then to -> ItemWriter to save to Database.
What classes I can leave in the Configuration level as spring beans and what classes can I move to Service layer
I have seen this kind of question posted before but was never answered in detail.
Please help me figure this out.