From 39d82f135b0a45842e69da04e8ebdbe6a81fc69f Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 2 Feb 2024 11:30:31 +0100 Subject: [PATCH 1/2] Prepare issue branch. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a6973a6388..7e4a6ef701 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-redis - 3.2.3-SNAPSHOT + 3.2.x-2838-SNAPSHOT Spring Data Redis Spring Data module for Redis From cf68e0438ba134a413e7010afa5a1cc1bd3d6953 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 2 Feb 2024 11:41:56 +0100 Subject: [PATCH 2/2] Resolve element type from NodeType before falling back to reflection when reading values from JsonNode. This commit changes the node value retrieval so that it first tries to determine the node type before falling back to reflective access of the _value field. --- .../data/redis/hash/Jackson2HashMapper.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java b/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java index 4c68825c90..e33243b6b0 100644 --- a/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/Jackson2HashMapper.java @@ -436,8 +436,20 @@ private void flattenElement(String propertyPrefix, Object source, Map resultMap.put(propertyPrefix, element.textValue()); + case NUMBER -> resultMap.put(propertyPrefix, element.numberValue()); + case BOOLEAN -> resultMap.put(propertyPrefix, element.booleanValue()); + case BINARY -> { + try { + resultMap.put(propertyPrefix, element.binaryValue()); + } catch (IOException e) { + throw new IllegalStateException(e); + } + } + default -> resultMap.put(propertyPrefix, new DirectFieldAccessFallbackBeanWrapper(element).getPropertyValue("_value")); + } } }