In my web application, there are many types of domain objects, such as MemberModel, PostModel, CreditsModel, etc. I found that the type of the object is needed when setting up JacksonJsonRedisSerializer, so I pointed out Object.class. But when deserializing the objects, I got an error.
To get around this, I have 2 options:
- Use instead
JdkSerializationRedisSerializer. But the result of serialization is too long, so it will consume a lot of memory in Redis. - Set up a serializer for each domian object, which means that if I have 50 domain objects, then I need to set up 50 serializers. But this is obviously quite tiring.
Is there an elegant way to solve this problem? Thank!
source
share