-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Is there a way to support GenericJackson2JsonRedisSerializer? #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report! I think maybe someone from the Spring Data Redis team might be better qualified to answer this. @christophstrobl Any ideas? |
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
abstract class MixIn {
@JsonIgnore
abstract boolean isExpired();
}
// ...
ObjectMapper mapper = new ObjectMapper()
mapper.setVisibility(
mapper.getVisibilityChecker()
.withFieldVisibility(Visibility.ANY)
.withGetterVisibility(Visibility.NONE)
.withSetterVisibility(Visibility.NONE)
.withCreatorVisibility(Visibility.NONE));
mapper.addMixIn(MapSession.class, MixIn.class); // register the MixIn
mapper.enableDefaultTypingAsProperty(DefaultTyping.NON_FINAL, "@class"); // enable default typing
GenericJackson2JsonRedisSerializer serializer = new GenericJackson2JsonRedisSerializer(mapper); Additional customizations might be required for sepecific session content. |
@christophstrobl Thanks for the very detailed answer! @FalconIA Can you respond if this answers your question? |
@christophstrobl Thanks for your answer. I try to customize
It works well! |
thanks @FalconIA for letting us know! glad it works! |
@FalconIA Awesome! Given your feedback I'm going to close this. |
To free up memory, I try to use GenericJackson2JsonRedisSerializer instead.
Then get a exception:
Here is a hash value session example:
The text was updated successfully, but these errors were encountered: