diff options
Diffstat (limited to 'juick-www/src')
4 files changed, 7 insertions, 21 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; diff --git a/juick-www/src/test/java/com/juick/www/WebAppTests.java b/juick-www/src/test/java/com/juick/www/WebAppTests.java index 773a6d9a..fb9db34c 100644 --- a/juick-www/src/test/java/com/juick/www/WebAppTests.java +++ b/juick-www/src/test/java/com/juick/www/WebAppTests.java @@ -6,6 +6,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.juick.Message; import com.juick.User; import com.juick.configuration.MockDataConfiguration; +import com.juick.server.configuration.BaseWebConfiguration; import com.juick.service.MessagesService; import com.juick.service.UserService; import com.juick.tests.util.MockUtils; @@ -41,7 +42,7 @@ import static org.mockito.Mockito.when; public class WebAppTests { @Configuration @Import(value = { - WwwServletConfiguration.class, WwwAppConfiguration.class, SapeConfiguration.class, + BaseWebConfiguration.class, WwwServletConfiguration.class, WwwAppConfiguration.class, SapeConfiguration.class, MockDataConfiguration.class }) static class Config {} |