**
**
**
** 工程使用redis作为缓存,起初使用GenericJackson2JsonRedisSerializer作为序列化反序列化工具。一般正常的对象(set,get齐全),序列化以及解序列化都没有问题。但是一旦某个对象只有get方法,而没有set方法。就无法正常反序列化。
留意最后一个方法 getGrade(){ return “grade1”; } 只有get
**
**
org.springframework.data.redis.serializer.SerializationException: Could not read JSON:Unrecognized field "grade" (class cn.pxwell.showen.Demo), not marked as ignorable (2 known properties: "name", "age"]) at [Source: (byte[])"{"@class":"cn.pxwell.showen.Demo","name":"张三","age":3,"grade":"grade1"}"; line: 1, column: 68] (through reference chain: cn.pxwell.showen.Demo["grade"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "grade" (class cn.pxwell.showen.Demo), not marked as ignorable (2 known properties: "name", "age"]) at [Source: (byte[])"{"@class":"cn.pxwell.showen.Demo","name":"张三","age":3,"grade":"grade1"}"; line: 1, column: 68] (through reference chain: cn.pxwell.showen.Demo["grade"])error提示: Could not read JSON: N/A
