本文主要是介绍stringRedisTemplate.opsForValue().increment(key)报空指针异常,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
解决办法:https://www.jianshu.com/p/789b33b5943e
BUG复现满足以下条件可触发:
1.在RedisConfig开启Redis事务
redisTemplate.setEnableTransactionSupport(true);
2.业务中开启事务
@Transactional
3.同一个业务下用生产多点id就报这个错误了
Cannot invoke "java.lang.Long.longValue()" because the return value of "org.springframework.data.redis.core.ValueOperations.increment(Object, long)" is null
Cannot invoke "java.lang.Long.longValue()" because the return value of "org.springframework.data.redis.core.ValueOperations.increment(Object, long)" is null`
解决办法:https://www.jianshu.com/p/789b33b5943e
这篇关于stringRedisTemplate.opsForValue().increment(key)报空指针异常的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!