org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception

Posted 闲言_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception相关的知识,希望对你有一定的参考价值。

错误产生环境

RedisTemplate 将数据写入redis 时产生

错误描述

org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: 
Failed to serialize object using DefaultSerializer; nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable 
payload but received an object of type [cn.bloghut.pojo.User]

错误原因

pojo 类没有序列化导致的

解决办法

实现 Serializable接口

以上是关于org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception的主要内容,如果未能解决你的问题,请参考以下文章

添加 HAL 浏览器时出错:找不到依赖项 'org.springframework.data:spring-data-rest-hal-browser:'

嵌套异常是 java.lang.NoClassDefFoundError: org/springframework/data/mapping/IdentifierAccessor

MongoDB $addFields 使用 org.springframework.data.mongodb.core.MongoTemplate

org.springframework.data.annotation.Transient 和 javax.persistence.Transient 的区别

@Transient 注解、@org.springframework.data.annotation.Transient 注解、transient 关键字和密码存储

org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception