From b8651556c21c83448e46b270ed7013f490e53a5d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 29 Mar 2017 12:52:41 +0300 Subject: juick-www: inject json mapper --- .../com/juick/www/configuration/WwwAppConfiguration.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'juick-www/src/main/java/com/juick/www/configuration') diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java index 7ffefb1d..beb3f95f 100644 --- a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java +++ b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java @@ -1,5 +1,8 @@ package com.juick.www.configuration; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.juick.service.TagService; import com.juick.service.UserService; import com.juick.www.HelpService; @@ -47,4 +50,14 @@ public class WwwAppConfiguration { return new HelpService("help"); } + @Bean + public ObjectMapper jsonMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); + mapper.registerModule(new Jdk8Module()); + return mapper; + } + } -- cgit v1.2.3