SpringBoot
自带的缓存注解@EnableCaching
和@Cacheable
时,报错DefaultSerializer requires a Serializable payload but received an object of type
。要缓存的 Java 对象必须实现 Serializable 接口,因为 Spring 会将对象先序列化再存入 Redis,将缓存实体类继承 Serializable。SpringBoot
自带的缓存注解@EnableCaching
和@Cacheable
时,报错DefaultSerializer requires a Serializable payload but received an object of type
。要缓存的 Java 对象必须实现 Serializable 接口,因为 Spring 会将对象先序列化再存入 Redis,将缓存实体类继承 Serializable。