From 8418082a00a729deac28bdfbf4131a0ad3c4098e Mon Sep 17 00:00:00 2001 From: John Blum Date: Fri, 8 May 2020 00:54:14 -0700 Subject: [PATCH] Remove unnecessary ObjectMapper configuration used specifically for deserialization. Clearly, this configuration is 'unnecessary' because the ObjectMapper is used to serialize Objects to JSON in this converter. Removes Mixin that virtually annotated application domain model object types with @JsonIgnoreProperties for unknown/unmapped properties. Removes configuration to accept case insensitive Enum (String) values. Resolves gh-67. --- .../support/JacksonObjectToJsonConverter.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/spring-geode/src/main/java/org/springframework/geode/data/json/converter/support/JacksonObjectToJsonConverter.java b/spring-geode/src/main/java/org/springframework/geode/data/json/converter/support/JacksonObjectToJsonConverter.java index 601f0552..24d8935f 100644 --- a/spring-geode/src/main/java/org/springframework/geode/data/json/converter/support/JacksonObjectToJsonConverter.java +++ b/spring-geode/src/main/java/org/springframework/geode/data/json/converter/support/JacksonObjectToJsonConverter.java @@ -15,7 +15,6 @@ */ package org.springframework.geode.data.json.converter.support; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; @@ -27,9 +26,9 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.TypeDescriptor; import org.springframework.geode.data.json.converter.ObjectToJsonConverter; -import org.springframework.geode.data.json.jackson.databind.serializer.BigDecimalSerializer; -import org.springframework.geode.data.json.jackson.databind.serializer.BigIntegerSerializer; -import org.springframework.geode.data.json.jackson.databind.serializer.TypelessCollectionSerializer; +import org.springframework.geode.jackson.databind.serializer.BigDecimalSerializer; +import org.springframework.geode.jackson.databind.serializer.BigIntegerSerializer; +import org.springframework.geode.jackson.databind.serializer.TypelessCollectionSerializer; import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; @@ -87,9 +86,7 @@ public class JacksonObjectToJsonConverter implements ObjectToJsonConverter { ObjectMapper objectMapper = new ObjectMapper() .activateDefaultTypingAsProperty(null, DEFAULT_TYPING, AT_TYPE_METADATA_PROPERTY_NAME) .addMixIn(NonAccessibleType.class, ObjectTypeMetadataMixin.class) - .addMixIn(Object.class, IgnorePropertiesMixin.class) .configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true) - .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true) .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); objectMapper.registerModule(new SimpleModule(SPRING_BOOT_DATA_GEODE_JACKSON_MODULE_NAME, VERSION) @@ -103,10 +100,6 @@ public class JacksonObjectToJsonConverter implements ObjectToJsonConverter { @SuppressWarnings("unused") private interface NonAccessibleType { } - @JsonIgnoreProperties(ignoreUnknown = true) - @SuppressWarnings("unused") - interface IgnorePropertiesMixin { } - @JsonTypeInfo( use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY,