title: How to read multiple files in chunks using Spring-Batch?
body: <p>I'm using <code>Spring-Batch</code> to read <code>csv</code> files sequentially with <code>MultiResourceItemReader</code>.</p>
  
  <p>I want to create a reader that</p>
  
  <ul>
  <li>reads the chunksize from file 1 </li>
  <li>reads the chunksize from file 2</li>
  <li>compare both what has been read and create some kind of "patch" object</li>
  <li>write the patch object to database</li>
  </ul>
  
  <p>Now the problem with <code>MultiResourceItemReader</code> is that it will first read the full file1 in chunks, and when the file is finished, it will continue with file2.</p>
  
  <p>How can I create batch steps that will switch between the files based on the chunksize?</p>