aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-05 16:14:47 +0300
committerGravatar Vitaly Takmazov2017-09-05 16:14:47 +0300
commit8e5160fcb39c90c83bcda58f1070d07a3dea498d (patch)
tree6d740478e9a1d1488581122ae990d18f1cf40ffe
parent75f208e86735d14de1ea5b74c5018d6ca29ee40a (diff)
api: fix configuration
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java4
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java3
-rw-r--r--juick-server-web/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java15
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<HttpMessageConverter<?>> converters) {
+ public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(jsonMapper());
converters.add(converter);
super.configureMessageConverters(converters);