title: Spring Batch ItemReader list processed only once
body: <p>I'm trying to create a Spring Batch job using a <code>ListItemReader&lt;String&gt;</code>, <code>ItemProcessor&lt;String, String&gt;</code> and <code>ItemWriter&lt;String&gt;</code>.</p>
  
  <p>The XML looks like the following,</p>
  
  <pre><code>&lt;job id="sourceJob" xmlns="http://www.springframework.org/schema/batch"&gt;
      &lt;step id="step1" next="step2"&gt;
          &lt;tasklet&gt;
              &lt;chunk reader="svnSourceItemReader" 
                  processor="metadataItemProcessor" 
                  writer="metadataItemWriter" 
                  commit-interval="1" /&gt;
          &lt;/tasklet&gt;
      &lt;/step&gt;
      &lt;step id="step2"&gt;
          &lt;tasklet ref="lastRevisionLoggerTasklet"&gt;&lt;/tasklet&gt;
      &lt;/step&gt;
  &lt;/job&gt;
  
  &lt;bean id="svnSourceItemReader" 
          class="com.example.repository.batch.SvnSourceItemReader" 
          scope="prototype"&gt;
      &lt;constructor-arg index="0"&gt;
          &lt;list&gt;
              &lt;value&gt;doc1.xkbml&lt;/value&gt;
              &lt;value&gt;doc2.xkbml&lt;/value&gt;
              &lt;value&gt;doc3.xkbml&lt;/value&gt;
          &lt;/list&gt;
      &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  
  &lt;bean id="metadataItemProcessor" 
          class="com.example.repository.batch.MetadataItemProcessor" 
          scope="prototype" /&gt;
  
  &lt;bean id="metadataItemWriter" 
          class="com.example.repository.batch.MetadataItemWriter" 
          scope="prototype" /&gt;
  </code></pre>
  
  <p>The reader, processor and writer are vanilla,</p>
  
  <pre><code>public class SvnSourceItemReader extends ListItemReader&lt;String&gt; {
  
      public SvnSourceItemReader(List&lt;String&gt; list) {
          super(list);
          System.out.println("Reading data list " + list);
      }
  
      @Override
      public String read() {
          String out = (String) super.read();
          System.out.println("Reading data " + out);
          return out;
      }
  
  }
  
  public class MetadataItemProcessor implements ItemProcessor&lt;String, String&gt; {
  
      @Override
      public String process(String i) throws Exception {
          System.out.println("Processing " + i + " : documentId " + documentId);
          return i;
      }
  
  }
  
  public class MetadataItemWriter implements ItemWriter&lt;String&gt; {
  
      @Override
      public void write(List&lt;? extends String&gt; list) throws Exception {
          System.out.println("Writing " + list);
      }
  
  }
  </code></pre>
  
  <p>The job is started like this, but on a schedule of every 10 seconds.</p>
  
  <pre><code>long nanoBits = System.nanoTime() % 1000000L;
  if (nanoBits &lt; 0) {
      nanoBits *= -1;
  }
  String dateParam = new Date().toString() + System.currentTimeMillis() 
          + "." + nanoBits;
  param = new JobParametersBuilder().addString("date", dateParam)
          .toJobParameters();
  JobExecution execution = jobLauncher.run(job, param);
  </code></pre>
  
  <p>When the application starts, I see it read, process and write each of the three items in the list passed to the reader.</p>
  
  <pre><code>Reading data doc1.xkbml
  Processing doc1.xkbml : documentId doc1
  Writing [doc1.xkbml]
  Reading data doc2.xkbml
  Processing doc2.xkbml : documentId doc2
  Writing [doc2.xkbml]
  Reading data doc3.xkbml
  Processing doc3.xkbml : documentId doc3
  Writing [doc3.xkbml]
  </code></pre>
  
  <p>Because this <code>sourceJob</code> is on a scheduled timer, every 10 seconds I expected to see that list processed, but instead I see on all subsequent runs.</p>
  
  <pre><code>Reading data null
  </code></pre>
  
  <p>Does anyone know why this is happening? I'm new to Spring Batch and just can't get my hands around the issue.</p>
  
  <p>Thanks /w</p>