0
當我試圖將一個對象添加到會話如下:添加對象的HttpSession中SpringBoot失敗,Redis的
HttpSession session = ....
MyObject object = ....
session.setAttribute("my_object", object);
然後我得到一個異常:
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 [MyObject]
我應該怎麼做指示REDIS序列化對象MyObject
?
是的,謝謝,它的工作原理 –