序列化错误

发布时间 2023-10-20 15:23:05作者: L&Y`

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 [com.atguigu.gulimall.authserver.vo.MemberResponseVo]

这里使用的spring-session存储的,因为是通过reids的,所以默认需要序列化器,

解决方法:

1、我们在MemberResponseVo  implement  Searilizer (这个是二进制流)

2、我们配置JSON的序列化器Bean