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 --- .../java/com/juick/api/configuration/ApiAppConfiguration.java | 10 +++++----- .../main/java/com/juick/api/configuration/ApiInitializer.java | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'juick-api/src/main/java/com/juick/api') diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java index 7ef1cf45..520f21eb 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java @@ -2,12 +2,11 @@ package com.juick.api.configuration; import com.juick.api.ApiServer; import com.juick.api.TGBot; -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 com.juick.server.configuration.BaseWebConfiguration; +import org.springframework.context.annotation.*; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.socket.client.WebSocketConnectionManager; import org.springframework.web.socket.client.standard.StandardWebSocketClient; @@ -21,7 +20,8 @@ import javax.inject.Inject; @EnableAsync @PropertySource("classpath:juick.conf") @ComponentScan(basePackages = "com.juick.api.controllers") -public class ApiAppConfiguration { +@Import(BaseWebConfiguration.class) +public class ApiAppConfiguration extends WebMvcConfigurationSupport { @Inject TGBot tgBot; diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java b/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java index d01df787..9de0af9d 100644 --- a/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java +++ b/juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java @@ -1,7 +1,6 @@ package com.juick.api.configuration; import com.juick.configuration.DataConfiguration; -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; @@ -16,14 +15,14 @@ public class ApiInitializer extends AbstractAnnotationConfigDispatcherServletIni @Override protected Class[] getRootConfigClasses() { return new Class[]{ - ApiAppConfiguration.class, ApiSecurityConfig.class, DataConfiguration.class, + ApiSecurityConfig.class, DataConfiguration.class, TelegramConfiguration.class, MessengerConfiguration.class }; } @Override protected Class[] getServletConfigClasses() { - return new Class[]{BaseWebConfiguration.class}; + return new Class[]{ ApiAppConfiguration.class }; } @Override -- cgit v1.2.3