diff options
author | 2017-06-29 17:09:49 +0300 | |
---|---|---|
committer | 2017-06-29 17:13:29 +0300 | |
commit | b75b5a3d1a3bf001923d49923dcebee95ba2327e (patch) | |
tree | 5080eacdf348c9598885ad5d3b5c567632db3717 /juick-www/src/main/java/com/juick/www/configuration | |
parent | 02723131139806c761539a42a5fa80b68ecadee8 (diff) |
notifications and configurations refactoring
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/configuration')
3 files changed, 5 insertions, 20 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 2e5a4f89..8dc8093e 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 @@ -33,12 +33,14 @@ public class WwwAppConfiguration { private UserService userService; @Inject private TagService tagService; + @Inject + private ObjectMapper jsonMapper; @Bean public WebApp webApp() throws IOException { WebApp app = new WebApp(); String manifestString = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("manifest.json"), StandardCharsets.UTF_8); - HashMap<String, String> manifest = jsonMapper().readValue(manifestString, + HashMap<String, String> manifest = jsonMapper.readValue(manifestString, new TypeReference<HashMap<String, String>>() {}); app.setScriptsUrl(manifest.get("scripts.js")); app.setStyleUrl(manifest.get("style.css")); @@ -58,14 +60,4 @@ 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; - } - } diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java b/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java index 199fbf85..bc5851db 100644 --- a/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java +++ b/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java @@ -2,6 +2,7 @@ package com.juick.www.configuration; import com.juick.configuration.DataConfiguration; import com.juick.configuration.SearchConfiguration; +import com.juick.server.configuration.BaseWebConfiguration; import org.apache.commons.codec.CharEncoding; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; @@ -18,6 +19,7 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni @Override protected Class<?>[] getRootConfigClasses() { return new Class<?>[]{ + BaseWebConfiguration.class, WwwAppConfiguration.class, DataConfiguration.class, SearchConfiguration.class, diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java index ae51f1cd..d7e5c72e 100644 --- a/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java +++ b/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java @@ -31,8 +31,6 @@ import java.util.concurrent.TimeUnit; @ComponentScan(basePackages = {"com.juick.www.controllers"}) @PropertySource("classpath:juick.conf") public class WwwServletConfiguration extends WebMvcConfigurationSupport { - @Inject - private Environment env; @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { @@ -61,13 +59,6 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport { return result; } - @Bean - public MultipartResolver multipartResolver() { - CommonsMultipartResolver resolver = new CommonsMultipartResolver(); - resolver.setMaxUploadSize(10000000); - return resolver; - } - @Inject private ServletContext servletContext; |