spring boot 项目中redis 序列化异常:org.springframework.data.redis.serializer.SerializationException

spring boot 项目中redis 序列化异常:org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using
异常原因
redis缓存的类没有实现学序列化接口,导致redis序列化失败。

public class Department  {
    
    
    private Integer departmentId;

    private String departmentCode;

    private String departmentName;

改为:

import java.io.Serializable;
public class Department  implements Serializable {
    
    
    private Integer departmentId;

    private String departmentCode;

    private String departmentName;

猜你喜欢

转载自blog.csdn.net/m0_52896752/article/details/126600369