springboot项目使用redis报错:
- org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is java.io.StreamCorruptedException: invalid stream header: 3139322E
-
今天在使用redis的get方法的时候,出现这个错误
-
不是springboot项目的需要在xml配置文件中设置,原理一样
一、原因:
- 使用springboot-data-redis,默认情况下是使用org.springframework.data.redis.serializer.JdkSerializationRedisSerializer这个类来做序列化.
- 也可能是自己的设置问题,比如我的:最后一个设置的是JdkSerializationRedisSerializer做序列化
二、报错截图:
我的在这里引入RedisConfig配置
