title: Spring batch: processing multiple record at once
body: <p>I am using spring batch and as normally used I have reader , processor and writer .</p>
  
  <p>I have 2 questions</p>
  
  <p>1>
  Reader queries all 200 records (total record size in table is 200 and I have given pagesize=200 )and thus it gets me all 200 records, and in processor we want list of all these record because we have to compare each record with other 199 records to group them in different tiers .
  Thus I am thinking if we can get that list in processing step , I can manipulate them .how should I approach .</p>
  
  <p>2>
  In processing stage I need some master data from database depending on which all input records will be processed .i m thinking of injection of data source in processing bean and fetch all master table data and process all records. Is it good approach or please suggest otherwise .</p>
  
  <pre><code>&lt;job id="sampleJob"&gt;
      &lt;step id="step1"&gt;
          &lt;tasklet&gt;
              &lt;chunk reader="itemReader" processor="processor" writer="itemWriter" commit-interval="20"/&gt;
          &lt;/tasklet&gt;
      &lt;/step&gt;
  &lt;/job&gt;
  </code></pre>
  
  <p>And the processor is </p>
  
  <pre><code>@Override
  public User process(Object item) throws Exception {
      // transform item to user
      return user;
  }
  </code></pre>
  
  <p>And I want something like </p>
  
  <pre><code>public List&lt;User&gt; process(List&lt;Object&gt; item) throws Exception {
      // transform item to user
      return user;
  }
  </code></pre>
  
  <p>I found some post <a href="http://forum.spring.io/forum/spring-projects/batch/111650-itemprocessor-receiving-one-item-returning-more-than-one" rel="nofollow">here</a> but they say to get the list in writer .But i dont like to process anything in writer, because that kills the defination of writer and processor. Is there any configuration to get the list inside this process method.</p>
  
  <p>Thank you</p>