diff options
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/configuration')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java | 13 |
1 files changed, 13 insertions, 0 deletions
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; + } + } |