要缓存的 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]]。
java.lang.IllegalArgumentException: DefaultSerializer requires a Serializable payload but received a
最新推荐文章于 2022-08-18 10:09:18 发布