title: Multi-threading with Spring batch File Item Reader
body: <p>In a Spring Batch I am trying to read a CSV file and want to assign each row to a separate thread and process it. I have tried to achieve it by using TaskExecutor, but what is happening all the thread is picking the same row at a time. I also tried to implement the concept using Partioner, there also same thing happening. Please see below my Configuration Xml.</p>
  
  <p>Step Description</p>
  
  <pre><code>    &lt;step id="Step2"&gt;
          &lt;tasklet task-executor="taskExecutor"&gt;
              &lt;chunk reader="reader" processor="processor" writer="writer" commit-interval="1" skip-limit="1"&gt;
              &lt;/chunk&gt;
          &lt;/tasklet&gt; 
      &lt;/step&gt;
  
                &lt;bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader"&gt;
  &lt;property name="resource" value="file:cvs/user.csv" /&gt;
  
  &lt;property name="lineMapper"&gt;
      &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
        &lt;!-- split it --&gt;
        &lt;property name="lineTokenizer"&gt;
              &lt;bean
            class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
              &lt;property name="names" value="userid,customerId,ssoId,flag1,flag2" /&gt;
          &lt;/bean&gt;
        &lt;/property&gt;
        &lt;property name="fieldSetMapper"&gt;   
  
            &lt;!-- map to an object --&gt;
            &lt;bean
              class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper"&gt;
              &lt;property name="prototypeBeanName" value="user" /&gt;
            &lt;/bean&gt;           
        &lt;/property&gt;
  
        &lt;/bean&gt;
    &lt;/property&gt;
  
         &lt;/bean&gt;
  
        &lt;bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor"&gt;
   &lt;property name="concurrencyLimit" value="4"/&gt;   
  </code></pre>
  
  <p>I have tried with different types of task executor, but all of them are behaving in same way. How can I assign each row to a separate thread?</p>