title: Spring batch - How to write data multiple rows after processing single record?
body: <p>I have bean class as below -</p>
  
  <pre><code>public class Account {
      private String strAccNumber = "";
  
      private List&lt;Account&gt; accountList = new ArrayList&lt;Account&gt;();
  
       // getter setter
  ....
  ...
  @Override
      public String toString() {
          // code for PassThroughLineAggregator
          String data="";
                      for (int j=0; j&lt;accountList.size(); j++) {
              Account bean = accountList.get(j);
              data = data + bean.getStrAccNumber();
              if (j&lt;(accountList.size()-1)) {
                  data = data + "\n";
                                  }       
          }
          return data;
      }
  }
  </code></pre>
  
  <p>to write data I want to set accountList in my config file.
  I'm using below code to set bean property.</p>
  
  <pre><code>  &lt;bean id="flatFileReader" class="org.springframework.batch.item.file.FlatFileItemReader"
      scope="step"&gt;
      &lt;property name="resource" value="classpath:springBatch.csv" /&gt;
      &lt;property name="strict" value="false"&gt;&lt;/property&gt;
      &lt;property name="linesToSkip" value="1" /&gt;
      &lt;property name="lineMapper"&gt;
          &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
              &lt;property name="lineTokenizer"&gt;
                  &lt;bean
                      class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
                      &lt;property name="names" value="ACC#" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
              &lt;property name="fieldSetMapper"&gt;
                  &lt;bean
                      class="com.abc.reader.AccountDetailsFieldSetMapper" /&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
   &lt;bean id="flatFileProcessor"
      class="com.abc.processor.AccountItemProcessor"
      scope="step"&gt;&lt;/bean&gt;
  &lt;bean id="flatFileWriter"
          class="com.abc.FlatFileItemWriterListener"
          scope="step"&gt;
          &lt;property name="resource" value="classpath:springBatch1.csv" /&gt;
  
          &lt;property name="lineAggregator"&gt;
              &lt;bean class="org.springframework.batch.item.file.transform.DelimitedLineAggregator"&gt;
                  &lt;property name="fieldExtractor"&gt;
                      &lt;bean class="org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor"&gt;
                          &lt;property name="names" value="strAccNumber" /&gt;
                      &lt;/bean&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt; 
  
      &lt;/bean&gt;
  </code></pre>
  
  <p>AccountItemProcessor -</p>
  
  <pre><code> public class AccountItemProcessor implements ItemProcessor&lt;Account, List&lt;Account&gt;&gt;{
  
  @Override
  public List&lt;Account&gt; process(Account accObj) throws Exception {
    // logic..
  }
  </code></pre>
  
  <p>After processing single record in the process step I want to write multiple items(list of item) , how can I write multiple item at a time using arraylist. In my case I want to write data from accountlist.</p>