Use the following serialization method to serialize the value of redis:
1:JdkSerializationRedisSerializer:
2:GenericJackson2JsonRedisSerializer
3:StringRedisSerializer
4:GenericFastJsonRedisSerializer
Found that only 4: GenericFastJsonRedisSerializer, best to use, no error
Let’s briefly introduce the following one by one
1:JdkSerializationRedisSerializer:
The serialized java object encountered the following error:
DefaultSerializer requires a Serializable payload but received an object of type [com.everestfortune.cf.bean.CaseInfoBean]
切换到logDB
Reason: Beans serialized using JdkSerializationRedisSerializer must implement the Serializable interface
2: GenericJackson2JsonRedisSerializer
gets the data in redis and encounters the following error:
2019-04-26 11:26:41.510 ERROR 11656 --- [nio-9076-exec-7] cecf.controller.ApplyController
: redis failed to get data, mes =Could not read JSON: Cannot construct instance of `java.time.LocalDate`
(no Creators, like default construct, exist):
cannot deserialize from Object value (no delegate- or property-based Creator)
Reason: LocalDate is a new class of java8, the serialization method of GenericJackson2JsonRedisSerializer cannot be recognized
3: StringRedisSerializer
cannot serialize Beans, but can only serialize string type data.
If the value is a string type, it can be serialized in this way
4: GenericFastJsonRedisSerializer:
No problems have been found so far