今天使用redis作为缓存。在往redis写数据时,需要指定序列化方式。网上找的示例,使用的是json序列化方式。照搬下来。发现可以正常写入。但是无法读出。
错误提示:
无法找的对应的构造器。
json反序列化话需要对应实体类有无参构造器。
因为实体类是框架封装的,改不了,故改成jdk序列化方式。