方法一:增加一行代码(推荐)
RedisConnectionUtils.unbindConnection(redisTemplate.getConnectionFactory());
方法二:修改RedisTemplate
RedisTemplate配置enableTransactionSupport为true(开启事务)时,连接不会自动释放,把它改成false即可
![](https://img.haomeiwen.com/i16864484/e9f2760e95f4ef62.png)
方法一:增加一行代码(推荐)
RedisConnectionUtils.unbindConnection(redisTemplate.getConnectionFactory());
方法二:修改RedisTemplate
RedisTemplate配置enableTransactionSupport为true(开启事务)时,连接不会自动释放,把它改成false即可
本文标题:redisTemplate关闭连接
本文链接:https://www.haomeiwen.com/subject/bqjxlrtx.html
网友评论