title: Spring Batch 3 Custom Writer with a List
body: <p>Imagine a Menu.java pojo with 3 fields: id, name and telephone.</p>
  
  <p>I'm using Spring Batch 3. My processor returns me a List. And I want to write on a file these values of each object of the list.</p>
  
  <p>If Menu wasn't a list, this would be my writer class:</p>
  
  <pre><code>@Bean(name="MyWriter")
  @SphynxBatchStepScope
  public FlatFileItemWriter&lt;Menu&gt; myWriter() String fileOutputName) {
  
      FlatFileItemWriter&lt;Menu&gt; writer = new FlatFileItemWriter&lt;Menu&gt;();   
      writer.setResource(new FileSystemResource("test.txt")));
      DelimitedLineAggregator&lt;Menu&gt; delLineAgg = new DelimitedLineAggregator&lt;Menu&gt;();
      delLineAgg.setDelimiter("          ");
      BeanWrapperFieldExtractor&lt;Menu&gt; fieldExtractor = new BeanWrapperFieldExtractor&lt;Menu&gt;();
      fieldExtractor.setNames(new String[] {"id", "name", "telephone"});
      delLineAgg.setFieldExtractor(fieldExtractor);
      writer.setLineAggregator(delLineAgg);
      writer.setHeaderCallback(header());
      writer.setFooterCallback(footer());
      writer.setEncoding("UTF-8");
  
      return writer;
  }
  </code></pre>
  
  <p>But if I want to covert this class to works with a List how can I do it?</p>
  
  <p>I can't find any solution. Only this: </p>
  
  <p><a href="https://stackoverflow.com/questions/37866312/using-an-itemwriter-with-list-of-lists/37866590#37866590">Using an ItemWriter with List of Lists</a></p>
  
  <p>But I don't see how implement this. For example, where and how call to setDelegate method. Or when I need to put my "id", "name", "telephone" sequence.</p>
  
  <p>Please, does anybody knows a code example with a custom Writer with List?</p>
  
  <p>Thanks in advance</p>