Skip to content

Reuse JsonNode in GenericJackson2JsonRedisSerializer#3366

Draft
DragonFSKY wants to merge 1 commit into
spring-projects:mainfrom
DragonFSKY:gh-3012-reuse-json-node
Draft

Reuse JsonNode in GenericJackson2JsonRedisSerializer#3366
DragonFSKY wants to merge 1 commit into
spring-projects:mainfrom
DragonFSKY:gh-3012-reuse-json-node

Conversation

@DragonFSKY
Copy link
Copy Markdown

Closes #3012

This change avoids parsing the same payload twice when GenericJackson2JsonRedisSerializer resolves the target type from default typing metadata.

TypeResolver now returns the resolved JavaType together with the parsed JsonNode. For serializer-managed default readers, deserialization can reuse that tree through a TreeTraversingParser instead of parsing the original byte array again.

Custom Jackson2ObjectReader instances continue to receive the original byte[] source, and the existing protected resolveType(...) contract remains unchanged.

Tests:

  • ./mvnw -s settings.xml -Dtest=GenericJackson2JsonRedisSerializerUnitTests#defaultReaderReusesJsonNodeParsedForTypeResolution test
  • ./mvnw -s settings.xml -Dtest=GenericJackson2JsonRedisSerializerUnitTests,GenericJacksonJsonRedisSerializerUnitTests,Jackson2JsonRedisSerializerTests,JacksonJsonRedisSerializerTests test

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 12, 2026
Signed-off-by: dragonfsky <dragonfsky@gmail.com>
@DragonFSKY DragonFSKY force-pushed the gh-3012-reuse-json-node branch from f2af3b2 to dd8e3b2 Compare May 12, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid potential duplicate parse operation within GenericJackson2JsonRedisSerializer.

2 participants