From c99b9350be030bfbf87829956a182753a81d07a2 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 29 Jun 2017 17:09:49 +0300 Subject: MVC was not enabled in apps based on BaseWebConfiguration --- .../NotificationsAppConfiguration.java | 23 +++++----------------- .../configuration/NotificationsInitializer.java | 5 ++--- 2 files changed, 7 insertions(+), 21 deletions(-) (limited to 'juick-notifications') diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java index b8730bfb..b50edfd5 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java @@ -1,20 +1,16 @@ package com.juick.components.configuration; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.juick.components.CleanUp; import com.juick.components.Notifications; +import com.juick.server.configuration.BaseWebConfiguration; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.*; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.InterceptingClientHttpRequestFactory; import org.springframework.http.client.support.BasicAuthorizationInterceptor; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.web.client.RestTemplate; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import java.util.Collections; import java.util.List; @@ -26,7 +22,8 @@ import java.util.List; @EnableScheduling @PropertySource("classpath:juick.conf") @ComponentScan(basePackages = {"com.juick.components.service"}) -public class NotificationsAppConfiguration { +@Import(BaseWebConfiguration.class) +public class NotificationsAppConfiguration extends WebMvcConfigurationSupport { @Value("${api_user:juick}") private String apiUser; @Value("${api_password:secret}") @@ -47,16 +44,6 @@ public class NotificationsAppConfiguration { return new Notifications(); } - @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; - } - @Bean public CleanUp cleanUp() { return new CleanUp(); diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java index 8ecf72ea..cc604b02 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java @@ -1,6 +1,5 @@ package com.juick.components.configuration; -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; @@ -15,14 +14,14 @@ public class NotificationsInitializer extends AbstractAnnotationConfigDispatcher @Override protected Class[] getRootConfigClasses() { return new Class[]{ - NotificationsAppConfiguration.class, APNSConfiguration.class, MPNSConfiguration.class, + APNSConfiguration.class, MPNSConfiguration.class, GCMConfiguration.class, XMPPConfiguration.class }; } @Override protected Class[] getServletConfigClasses() { - return new Class[]{ BaseWebConfiguration.class }; + return new Class[]{ NotificationsAppConfiguration.class }; } @Override -- cgit v1.2.3