From 64bd09f4cbedc7590f27e1cbdcbcabf66121c398 Mon Sep 17 00:00:00 2001 From: Matthew Luckam Date: Fri, 7 Oct 2022 16:40:01 -0500 Subject: [PATCH] Allow JacksonJsonpMapper user provided ObjectMapper to maintain configuration --- .../clients/json/jackson/JacksonJsonpMapper.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/json/jackson/JacksonJsonpMapper.java b/java-client/src/main/java/co/elastic/clients/json/jackson/JacksonJsonpMapper.java index 3a6e827ff..8e15e9682 100644 --- a/java-client/src/main/java/co/elastic/clients/json/jackson/JacksonJsonpMapper.java +++ b/java-client/src/main/java/co/elastic/clients/json/jackson/JacksonJsonpMapper.java @@ -45,17 +45,17 @@ private JacksonJsonpMapper(ObjectMapper objectMapper, JacksonJsonProvider provid } public JacksonJsonpMapper(ObjectMapper objectMapper) { - this( - objectMapper - .configure(SerializationFeature.INDENT_OUTPUT, false) - .setSerializationInclusion(JsonInclude.Include.NON_NULL), + this(objectMapper, // Creating the json factory from the mapper ensures it will be returned by JsonParser.getCodec() new JacksonJsonProvider(objectMapper.getFactory()) ); } public JacksonJsonpMapper() { - this(new ObjectMapper()); + this(new ObjectMapper() + .configure(SerializationFeature.INDENT_OUTPUT, false) + .setSerializationInclusion(JsonInclude.Include.NON_NULL) + ); } @Override