I have successfully read item from the database using spring batch.
Now I have to write this into a xml file but here is a catch xml file size which can not be more than 100mb if it is then content should be written to another file .
Is there any way that we can limit file size while configuring writer step or will I have to implement custom writer. Any suggestions?
The closest you can get out of the box is the
MultiResourceItemWriter
. This item writer will create multiple output files based on item number: whenever the number of written items exceeds a given limit, it will create a new file. So if you can estimate the maximum number of items to be written without exceeding 100MB per file, then this writer can help.Otherwise you will need to write a custom multi-resource item writer that is based on output file size instead of item number.