As described in detail in this Jackson issue, it is currently not possible to use GenericJackson2JsonRedisSerializer with final classes. That's especially blocking in Kotlin where classes are final by default, and data classes always final.
I have just upgraded Jackson to 2.10.0 in Framework, in time for our 5.2 GA, and Boot will pick up as well. Is it possible to use DefaultTyping.EVERYTHING in order to solve this blocking issue that impacts Kotlin developers?
GenericJackson2JsonRedisSerializer can be created with a given ObjectMapper so you should be able to construct the serializer yourself. We could switch the default. Since the change should be minimal, feel free to submit a pull request and make sure all tests are green.
@mp911de - Started working on a simple PR for that to swap over the DefaultTyping to EVERYTHING enum and added a test for it. Looks like it breaks the null serialization though with shouldSerializeNullValueSoThatItCanBeDeserializedWithDefaultTypingEnabled() throwing a:
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Type id handling not implemented for type org.springframework.cache.support.NullValue
I can still go ahead and submit the PR if you want but I'm a bit at a loss for that one.
For the failing test in GenericJackson2JsonRedisSerializerUnitTests we need to add an override for serializeWithType to the NullValueSerializer that delegates to serialize.
Still, there are more problems related to moving to EVERYTHING.
The DefaultTypeResolverBuilder always returns true when requesting useType even when the given one is a TreeNode.
This breaks the integration test for the Jackson2HashMapper. It seems we need to provide our own flavour of DefaultTypeResolverBuilder that does something like
and hook it into the ObjectMapper by overriding _constructDefaultTypeResolverBuilder.