博客
关于我
springboot redis key乱码
阅读量:654 次
发布时间:2019-03-16

本文共 1120 字,大约阅读时间需要 3 分钟。

原写法:

@Autowiredprivate RedisTemplate redisTemplate;

 

写入redis后,查看key值

127.0.0.1:6379> keys *1) "\xac\xed\x00\x05t\x00#ContentPlatform2:ES:UpSertESContent"2) "\xac\xed\x00\x05t\x00%ContentPlatform2:Lock_v16:CJH_ARTICLE"3) "\xac\xed\x00\x05t\x00!ContentPlatform2:Lock_v16:V_VIDEO"4) "\xac\xed\x00\x05t\x00\x1bContentPlatform2:ES:Content"5) "\xac\xed\x00\x05t\x00#ContentPlatform2:Lock_v16:CJH_VIDEO"6) "\xac\xed\x00\x05t\x00%ContentPlatform2:Lock_v16:CMS_ARTICLE"

 

解决方式:

private RedisTemplate redisTemplate;@Autowired(required = false)public void setRedisTemplate(RedisTemplate redisTemplate) {     RedisSerializer stringSerializer = new StringRedisSerializer();     redisTemplate.setKeySerializer(stringSerializer);     redisTemplate.setValueSerializer(stringSerializer);     redisTemplate.setHashKeySerializer(stringSerializer);     redisTemplate.setHashValueSerializer(stringSerializer);     this.redisTemplate = redisTemplate;}

 

调整后查看redis key值:

127.0.0.1:6379> keys *1) "ContentPlatform2:Lock_v17:V_VIDEO"2) "ContentPlatform2:Lock_v17:CMS_ARTICLE"3) "ContentPlatform2:ES:Content"4) "ContentPlatform2:Lock_v17:CJH_ARTICLE”

 

转载地址:http://zmdqz.baihongyu.com/

你可能感兴趣的文章
如何用华为位置服务实现搜索位置返回父子节点信息
查看>>
2020年云南省专升本 - 「计算机」专业各院校招生计划
查看>>
同一个实例注册到两个eureka上面
查看>>
【数据库】实验二~六
查看>>
uni-app的请求数据的封装
查看>>
C++容器笔记
查看>>
Android 四大组件、五大存储、六大布局总结
查看>>
【VRP问题】基于模拟退火改进遗传算法求解带时间窗含充电站的车辆路径规划问题EVRPTW
查看>>
【图像识别】基于模板匹配实现手写数字识别
查看>>
【语音去噪】最小二乘法(LMS)自适应滤波器matlab源码
查看>>
【边缘检测】基于CNN的灰度图像边缘提取matlab源码
查看>>
打工族有房有车,原来是这么实现的
查看>>
算法 顺序查找/折半查找/冒泡排序/选择排序(待改)
查看>>
华为1+X网络系统建设与运维(中级)——4.1 VLAN技术原理
查看>>
HDFS的学习积累
查看>>
Rancher入门到精通-2.0 systemctl 启动服务Connection timed out
查看>>
Rancher从入门到精通-2.0 配置gitlab代码库 404页面 原因有点扯
查看>>
ProgresSql 连接 ssl off 错误
查看>>
短视频SDK技术选型
查看>>
浏览器打开winscp 系统错误。代码:5。 拒绝访问。
查看>>