aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java10
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiInitializer.java5
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java6
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java5
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java23
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/NotificationsInitializer.java5
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java10
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java5
-rw-r--r--juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotAppConfiguration.java10
-rw-r--r--juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java5
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java7
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java6
12 files changed, 42 insertions, 55 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 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
diff --git a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
index 2fcd3bfe..cd2887bb 100644
--- a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
+++ b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
@@ -1,11 +1,14 @@
package com.juick.components.configuration;
import com.juick.components.Crosspost;
+import com.juick.server.configuration.BaseWebConfiguration;
import com.juick.service.CrosspostService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
@@ -16,7 +19,8 @@ import javax.inject.Inject;
*/
@Configuration
@PropertySource("classpath:juick.conf")
-public class CrosspostAppConfiguration {
+@Import(BaseWebConfiguration.class)
+public class CrosspostAppConfiguration extends WebMvcConfigurationSupport {
@Inject
private Environment env;
@Inject
diff --git a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java
index 8eaab803..2dad77a6 100644
--- a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java
+++ b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostInitializer.java
@@ -1,7 +1,6 @@
package com.juick.components.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;
@@ -15,12 +14,12 @@ public class CrosspostInitializer extends AbstractAnnotationConfigDispatcherServ
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class<?>[]{CrosspostAppConfiguration.class, DataConfiguration.class};
+ return new Class<?>[]{ DataConfiguration.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
- return new Class<?>[]{BaseWebConfiguration.class};
+ return new Class<?>[]{ CrosspostAppConfiguration.class };
}
@Override
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}")
@@ -48,16 +45,6 @@ public class NotificationsAppConfiguration {
}
@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
diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
index b7e0e658..4edca8c6 100644
--- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
+++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
@@ -1,14 +1,13 @@
package com.juick.ws.configuration;
+import com.juick.server.configuration.BaseWebConfiguration;
import com.juick.server.protocol.JuickProtocol;
import com.juick.ws.WebsocketComponent;
import com.juick.ws.XMPPConnection;
-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.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.ServletWebSocketHandlerRegistry;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
@@ -25,7 +24,8 @@ import javax.inject.Inject;
@EnableScheduling
@EnableWebSocket
@PropertySource("classpath:juick.conf")
-class WebsocketConfiguration implements WebSocketConfigurer {
+@Import(BaseWebConfiguration.class)
+class WebsocketConfiguration extends WebMvcConfigurationSupport implements WebSocketConfigurer {
@Inject
private Environment env;
diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
index 21f51fcf..766ab454 100644
--- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
+++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
@@ -1,7 +1,6 @@
package com.juick.ws.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;
@@ -15,12 +14,12 @@ public class WebsocketInitializer extends AbstractAnnotationConfigDispatcherServ
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class<?>[]{WebsocketConfiguration.class, DataConfiguration.class};
+ return new Class<?>[]{ DataConfiguration.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
- return new Class<?>[]{ BaseWebConfiguration.class };
+ return new Class<?>[]{ WebsocketConfiguration.class };
}
@Override
diff --git a/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotAppConfiguration.java b/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotAppConfiguration.java
index 09b366b6..b1b70155 100644
--- a/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotAppConfiguration.java
+++ b/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotAppConfiguration.java
@@ -1,12 +1,11 @@
package com.juick.components.configuration;
import com.juick.components.XMPPBot;
+import com.juick.server.configuration.BaseWebConfiguration;
import com.juick.server.protocol.JuickProtocol;
-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.core.env.Environment;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import javax.inject.Inject;
@@ -16,7 +15,8 @@ import javax.inject.Inject;
@Configuration
@ComponentScan(basePackages = {"com.juick.components.controllers"})
@PropertySource("classpath:juick.conf")
-public class BotAppConfiguration {
+@Import(BaseWebConfiguration.class)
+public class BotAppConfiguration extends WebMvcConfigurationSupport {
@Inject
private Environment env;
diff --git a/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java b/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java
index 9e8745af..ce4afd0c 100644
--- a/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java
+++ b/juick-xmpp-bot/src/main/java/com/juick/components/configuration/BotInitializer.java
@@ -1,7 +1,6 @@
package com.juick.components.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;
@@ -15,12 +14,12 @@ public class BotInitializer extends AbstractAnnotationConfigDispatcherServletIni
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class<?>[]{BotAppConfiguration.class, DataConfiguration.class};
+ return new Class<?>[]{ DataConfiguration.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
- return new Class<?>[]{ BaseWebConfiguration.class };
+ return new Class<?>[]{ BotAppConfiguration.class };
}
@Override
diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
index 956b5bce..a0cf94a2 100644
--- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
+++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
@@ -8,11 +8,12 @@ import com.juick.components.XMPPConnection;
import com.juick.components.XMPPServer;
import com.juick.components.s2s.CleaningUp;
import com.juick.components.s2s.JuickBot;
-import com.juick.configuration.DataConfiguration;
+import com.juick.server.configuration.BaseWebConfiguration;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import javax.inject.Inject;
import java.util.concurrent.ExecutorService;
@@ -21,9 +22,9 @@ import java.util.concurrent.Executors;
@Configuration
@ComponentScan(basePackages = {"com.juick.components.controllers"})
@PropertySource("classpath:juick.conf")
-@Import(DataConfiguration.class)
+@Import(BaseWebConfiguration.class)
@EnableScheduling
-public class XmppAppConfiguration {
+public class XmppAppConfiguration extends WebMvcConfigurationSupport {
@Inject
private Environment env;
diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java
index b7c096db..c3c98f41 100644
--- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java
+++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java
@@ -1,6 +1,6 @@
package com.juick.components.configuration;
-import com.juick.server.configuration.BaseWebConfiguration;
+import com.juick.configuration.DataConfiguration;
import org.apache.commons.codec.CharEncoding;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@@ -14,12 +14,12 @@ public class XmppInitializer extends AbstractAnnotationConfigDispatcherServletIn
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class<?>[]{XmppAppConfiguration.class};
+ return new Class<?>[]{DataConfiguration.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
- return new Class<?>[]{ BaseWebConfiguration.class};
+ return new Class<?>[]{ XmppAppConfiguration.class};
}
@Override