spring的xml配置
junit代码
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private RedisTemplate redisTemplate;
@Resource(name="redisTemplate")
private ValueOperations ops;
@Test
public void testStringRedisTemple() {
System.out.println(redisTemplate);
System.out.println(ops);
//这里报错
ops.set("room", "622");
}

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
问了大神才知道是jedis版本太高了,spring-data-redis是1.5的版本,jedis是2.7.2的版本,jedis版本太高
错误在这:
jedis 2.7.0 的connection类 :
而2.7.2版本以变:
所以SEND_COMMAND得到为null