1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| @Configuration public class JacksonConfiguration {
@Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder .deserializerByType(String.class, new StdScalarDeserializer<String>(String.class) {
private static final long serialVersionUID = -7069002275820643695L; @Override public String deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException { return StringUtils.trimToNull(jsonParser.getValueAsString()); } }); } }
|