title: ItemReader reader() in infinite loop
body: <p>I implemented ItemReader  with JdbcTemplate .  </p>
  
  <p>The problem is that <code>read()</code> is being invoked in infinite loop.</p>
  
  <pre><code>public class MyReader implements ItemReader&lt;Col&gt;, InitializingBean {
      private JdbcTemplate jdbcTemplate;
      private RowMapper&lt;Col&gt; rowMapper;
      private String sql;
      private DataSource dataSource;
  
  public Col read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
       Col col = jdbcTemplate.queryForObject(sql,null, rowMapper);            
       return col;
      }
  
  }
  </code></pre>
  
  <p>Spring batch configuration:</p>
  
  <pre><code>&lt;chunk reader="itemReader" writer="itemWriter"
              processor="itemProcessor" commit-interval="1" /&gt;
  
  
  &lt;bean id="itemReader"
      class="batch.MyReader"
      scope="step"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="sql" value="#{stepExecutionContext[sql]}" /&gt;
      &lt;property name="rowMapper"&gt;
          &lt;bean class="batch.ColMapper" /&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>