From a4179b479599c62a89b5e67dbfa0d28ad61c638b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 12 Feb 2020 18:32:32 +0100 Subject: [PATCH] Polishing --- .../context/annotation/ImportSelectorTests.java | 1 + .../http/codec/json/AbstractJackson2Decoder.java | 3 ++- .../http/codec/json/AbstractJackson2Encoder.java | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ImportSelectorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ImportSelectorTests.java index f310720b65..337c4c5d90 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ImportSelectorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ImportSelectorTests.java @@ -541,6 +541,7 @@ public class ImportSelectorTests { .collect(Collectors.toMap(entry -> entry.getKey().getClassName(), Map.Entry::getValue)); } + private final List instanceImports = new ArrayList<>(); @Override diff --git a/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java b/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java index 91507fdb24..2a2a501931 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java +++ b/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java @@ -112,7 +112,7 @@ public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport imple ObjectMapper mapper = getObjectMapper(); boolean forceUseOfBigDecimal = mapper.isEnabled(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS); - if (elementType != null && BigDecimal.class.equals(elementType.getType())) { + if (BigDecimal.class.equals(elementType.getType())) { forceUseOfBigDecimal = true; } @@ -224,6 +224,7 @@ public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport imple return getMimeTypes(); } + // Jackson2CodecSupport @Override diff --git a/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java b/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java index adccdd8083..7d2e4421ed 100644 --- a/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java +++ b/spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java @@ -240,6 +240,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple private ObjectWriter createObjectWriter(ResolvableType valueType, @Nullable MimeType mimeType, @Nullable Map hints) { + JavaType javaType = getJavaType(valueType.getType(), null); Class jsonView = (hints != null ? (Class) hints.get(Jackson2CodecSupport.JSON_VIEW_HINT) : null); ObjectWriter writer = (jsonView != null ?