title: SCAN command with spring redis template
body: <p>I am trying to execute "scan" command with RedisConnection. I don't understand why the following code is throwing NoSuchElementException</p>
  
  <pre><code>RedisConnection redisConnection = redisTemplate.getConnectionFactory().getConnection();
      Cursor c = redisConnection.scan(scanOptions);
      while (c.hasNext()) {
          c.next();
      }
  </code></pre>
  
  <p>Exception:</p>
  
  <blockquote>
    <p>java.util.NoSuchElementException  at
    java.util.Collections$EmptyIterator.next(Collections.java:4189)   at
    org.springframework.data.redis.core.ScanCursor.moveNext(ScanCursor.java:215)
      at
    org.springframework.data.redis.core.ScanCursor.next(ScanCursor.java:202)</p>
  </blockquote>