Skip to content

Support custom NullValueSerializer in GenericJackson2JsonRedisSerializer #2878

Closed
@ekeric13

Description

@ekeric13

If one wants a custom NullValueSerializer you can define your own registerNullValueSerializer, you cannot define your own NullValueSerializer

but because registerNullValueSerializer is static, you have to also overwrite other methods like the base constructors.

so how can one easily define their own nullValueSerializer?
the use case in particular i am using it as redis is used as the backend for @cachable and i want to cache the fact that i have a null value for some keys. the default null that the redis serializer uses is jsonGenerator.writeStringField(classIdentifier, NullValue.class.getName());, which produces a weird byte array that when i try to deserialize it (access the cache later) it gives me an error.

And then semi-related, if i overwrite the deserialize method to return null if i see the special null identifier, @cacheable considers it a cache miss. but i actually really do want to return the value null from my cache!!

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions