SpringBoot 错误(2)
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.InvalidClassException: com.example.cache.model.User; class invalid for deserialization
前有李云龙攻打平安县城,八路军总部日语二把刀电报监听员,反复听到敌人说着平安县城...
今有redis错误....从报错消息可看到serializer出现多次,即 序列化出错
解决方案
由于springBoot(spring)会将对象先序列化再存入redis,故针对此异常,修改对应的JavaBean对象即可,例如我将
public class User
改为
public class User implements Serializable