diff options
author | 2017-03-29 12:52:41 +0300 | |
---|---|---|
committer | 2017-03-29 12:52:41 +0300 | |
commit | b8651556c21c83448e46b270ed7013f490e53a5d (patch) | |
tree | 67c77b763ccc9ff21c6760e9957789ea65f1f00b /juick-www/src/main/java/com/juick/www/configuration | |
parent | bb7b8ef32d3c5b0a421ec641564ade7ab6b09c31 (diff) |
juick-www: inject json mapper
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; + } + } |