From 8e5160fcb39c90c83bcda58f1070d07a3dea498d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 5 Sep 2017 16:14:47 +0300 Subject: api: fix configuration --- .../com/juick/api/configuration/ApiAppConfiguration.java | 4 +--- .../java/com/juick/api/configuration/ApiInitializer.java | 3 +-- .../juick/server/configuration/BaseWebConfiguration.java | 15 +++++++-------- 3 files changed, 9 insertions(+), 13 deletions(-) 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 0b18a7c0..ad376594 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 @@ -25,7 +25,6 @@ import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.socket.client.WebSocketConnectionManager; import org.springframework.web.socket.client.standard.StandardWebSocketClient; import springfox.documentation.builders.PathSelectors; @@ -48,8 +47,7 @@ import java.util.Collections; @EnableSwagger2 @PropertySource("classpath:juick.conf") @ComponentScan(basePackages = "com.juick.api") -@Import(BaseWebConfiguration.class) -public class ApiAppConfiguration extends WebMvcConfigurerAdapter { +public class ApiAppConfiguration extends BaseWebConfiguration { @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 86f6c2b4..fa025e56 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 @@ -18,7 +18,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; @@ -33,7 +32,7 @@ public class ApiInitializer extends AbstractAnnotationConfigDispatcherServletIni @Override protected Class[] getRootConfigClasses() { return new Class[]{ - BaseWebConfiguration.class, ApiSecurityConfig.class, DataConfiguration.class, MessengerConfiguration.class + ApiSecurityConfig.class, DataConfiguration.class, MessengerConfiguration.class }; } diff --git a/juick-server-web/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java b/juick-server-web/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java index 7fdaca14..c0bd8b14 100644 --- a/juick-server-web/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java +++ b/juick-server-web/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java @@ -26,8 +26,8 @@ import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.multipart.MultipartResolver; import org.springframework.web.multipart.commons.CommonsMultipartResolver; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.util.List; @@ -35,17 +35,16 @@ import java.util.List; * Created by vitalyster on 28.06.2016. */ @Configuration -public class BaseWebConfiguration extends WebMvcConfigurationSupport { +public class BaseWebConfiguration extends WebMvcConfigurerAdapter { + @Override - public RequestMappingHandlerMapping requestMappingHandlerMapping() { - RequestMappingHandlerMapping mapping = super.requestMappingHandlerMapping(); - mapping.setUseSuffixPatternMatch(false); - return mapping; + public void configurePathMatch(PathMatchConfigurer configurer) { + configurer.setUseSuffixPatternMatch(false); } @Override - protected void configureMessageConverters(List> converters) { + public void configureMessageConverters(List> converters) { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(jsonMapper()); converters.add(converter); super.configureMessageConverters(converters); -- cgit v1.2.3