Spring-data-Redis SpringMvc + Redis 實現 redis快取報錯處理 序列化 反序列化報錯
阿新 • • 發佈:2019-01-31
1. 解決辦法: 在所使用的 java bean xxx.xxx.Account 新增預設的構造方法 public Account(){}
org.springframework.data.redis.serializer.SerializationException: Could not read JSON: Cannot construct instance of `xxx.xxx.Class` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
使用redis的序列化類為 GenericJackson2JsonRedisSerializer; 反序列化時報錯
2. 在所使用的java bean前加上redis的serialize介面實現
[redis][Serializer原理]DefaultSerializer requires a Serializable payload but received an object of type
http://www.paymoon.com:8001/index.php/2016/12/06/redisdefaultserializer-requires-a-serializable-payload-but-received-an-object-of-type/
使用redis的序列化類為 JdkSerializationRedisSerializer;序列化時錯誤