【发布时间】:2015-12-20 06:26:44
【问题描述】:
我正在尝试使用 RedisConnection 执行“扫描”命令。我不明白为什么下面的代码会抛出 NoSuchElementException
RedisConnection redisConnection = redisTemplate.getConnectionFactory().getConnection();
Cursor c = redisConnection.scan(scanOptions);
while (c.hasNext()) {
c.next();
}
例外:
java.util.NoSuchElementException 在 java.util.Collections$EmptyIterator.next(Collections.java:4189) 在 org.springframework.data.redis.core.ScanCursor.moveNext(ScanCursor.java:215) 在 org.springframework.data.redis.core.ScanCursor.next(ScanCursor.java:202)
【问题讨论】:
-
为了让这个问题更明显,您还应该使用“spring-data”、“scan”以及可能的其他值进行标记。
标签: spring redis spring-data