java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received

要缓存的 Java 对象必须实现 Serializable 接口,因为 Spring 会将对象先序列化再存入 Redis,比如的com.defonds.bdp.city.bean.City 类,
如果不实现 Serializable 的话将会遇到类似这种错误:
nested exception is java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received an object of type [com.defonds.bdp.city.bean.City]]。

posted on 2020-05-05 21:35  小破孩楼主  阅读(1092)  评论(0编辑  收藏  举报