title: How to use ItemReader with current chunk context?
body: <p>I'm trying to create an <code>ItemReader</code> for <code>spring-batch</code>. But the reader should be reinvoked on each <code>chunk</code>, and fetch additional data using the chunk parameter (which would result in some kind of pagination for the url):</p>
  
  <pre><code>private final RestTemplate tempalte = new RestTemplate();
  
  @Bean
  public ItemReader&lt;MyDTO&gt; getReader() {
      return tempalte.exchange(url, HttpMethod.GET, headers, currentChunkIndex); //TODO how to?
  }
  </code></pre>
  
  <p>Configured with:</p>
  
  <p>@Bean</p>
  
  <pre><code>public Step step() {
      return stepBuilder.get("jobname")
          .&lt;MyDTO, MyEntity&gt;chunk(100)
          .reader(getReader())
          .writer(getWriter())
          .build(),
  }
  </code></pre>
  
  <p>Question: hwo could I achieve this: refresh the reader on each <code>chunk</code> iteration, and moreover use the chunk index itself?</p>