@Test public void testValuesWithNoWhitespace() throws IOException { ObjectMapper objectMapper = ObjectMapperFactory.customObjectMapper(); TestModel model1 = new TestModel(); model1.stringField = "field 1"; model1.stringListField = List.of("item 1", "item 2"); model1.stringMapField = Map.of("key 1", "value 1", "key 2", "value 2"); String serialized = objectMapper.writeValueAsString(model1); TestModel deserialized = ObjectMapperFactory.customObjectMapper().readValue(serialized, TestModel.class); Assert.assertEquals("field 1", deserialized.stringField); Assert.assertEquals(List.of("item 1", "item 2"), deserialized.stringListField); Assert.assertEquals(ImmutableMap.of("key 1", "value 1", "key 2", "value 2"), deserialized.stringMapField); }
@Bean public static ObjectMapper customObjectMapper() { return Jackson2ObjectMapperBuilder.json() .modules(new InstantJsonModule(), new Jdk8Module(), new TrimKeysModule(), new TrimValuesModule()) .build(); }
ObjectMapperFactory { @Bean public static ObjectMapper customObjectMapper() { return Jackson2ObjectMapperBuilder.json() .modules(new InstantJsonModule(), new Jdk8Module(), new TrimKeysModule(), new TrimValuesModule()) .build(); } }
ObjectMapperFactory { @Bean public static ObjectMapper customObjectMapper() { return Jackson2ObjectMapperBuilder.json() .modules(new InstantJsonModule(), new Jdk8Module(), new TrimKeysModule(), new TrimValuesModule()) .build(); }  }
ObjectMapperFactory { @Bean public static ObjectMapper customObjectMapper() { return Jackson2ObjectMapperBuilder.json() .modules(new InstantJsonModule(), new Jdk8Module(), new TrimKeysModule(), new TrimValuesModule()) .build(); }  @Bean static ObjectMapper customObjectMapper(); }
ObjectMapperFactory { @Bean public static ObjectMapper customObjectMapper() { return Jackson2ObjectMapperBuilder.json() .modules(new InstantJsonModule(), new Jdk8Module(), new TrimKeysModule(), new TrimValuesModule()) .build(); }  @Bean static ObjectMapper customObjectMapper();  }