spring-data-redis 序列化 Integer Long類型轉換異常


redis使用Jackson2JsonRedisSerializer序列化問題

https://blog.csdn.net/weixin_33881041/article/details/91472219

解決方法

https://blog.csdn.net/qq_31445987/article/details/82260899

ZSetOperations zSetOperations = redisTemplate.opsForZSet();
Set<Object> idsSet = zSetOperations.reverseRange("xxxxx", 0L, -1L);
List<Long> ids = new ArrayList<>();
idsSet.forEach(e -> ids.add(e instanceof Integer ? ((Integer) e).longValue() : (Long) e));


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM