-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add a constructor with Module
to GenericJackson2JsonRedisSerializer
#2601
Comments
Module
to GenericJackson2JsonRedisSerializer
Exposing types from other libraries, such as Jackson, is not in the best interest of Spring Data Redis. A few reasons include, but are not limited to:
A better approach, particularly in the case of configuring and customizing the "internal" Jackson For example: class GenericJackson2JsonRedisSerializer {
public GenericJackson2JsonRedisSerializer configure(Consumer<ObjectMapper> configurer) {
// ...
}
// ...
} |
…Jackson2JsonRedisSerializer. We now allow the internally created Jackson ObjectMapper to be customized and further configured after construction of the GenericJackson2JsonRedisSerializer when a user does not explicitly provide a custom ObjectMapper during construction. Even when providing a custom ObjectMapper, not all configuration applied by the GenericJackson2JsonRedisSerialzier (such as (standard) type resolution) to the internal ObjectMapper would get applied to the user-provided ObjectMapper as well. Closes spring-projects#2601
Add since tag. Reformat code. See #2601
Add since tag. Reformat code. See #2601
Add since tag. Reformat code. See #2601
Adding Add a constructor with Module to
GenericJackson2JsonRedisSerializer
would be convenient.When I tried to register just
JavaTimeModule
to an ObjectMapper ofGenericJackson2JsonRedisSerializer
, I had to configure it from scratch like below.If the configuration already defined in a default constructor of
GenericJackson2JsonRedisSerializer
can be reused for addingModule
s, I think it could make codes simpler and easier.So it would look like below.
The text was updated successfully, but these errors were encountered: