aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com/juick/ws
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/XMPPConnection.java2
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java9
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java4
3 files changed, 12 insertions, 3 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
index 84158445..d30f8f03 100644
--- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
+++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.web.socket.TextMessage;
import rocks.xmpp.core.XmppException;
@@ -50,6 +51,7 @@ import java.util.stream.Collectors;
/**
* @author ugnich
*/
+@Component
public class XMPPConnection implements AutoCloseable {
private static final Logger logger = LoggerFactory.getLogger(XMPPConnection.class);
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 d1a6296a..c99d7a6d 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
@@ -20,6 +20,7 @@ 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;
@@ -31,6 +32,9 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
/**
* Created by aalexeev on 11/24/16.
*/
@@ -40,7 +44,10 @@ import org.springframework.web.socket.server.standard.ServletServerContainerFact
@EnableWebSocket
@PropertySource("classpath:juick.conf")
class WebsocketConfiguration extends BaseWebConfiguration implements WebSocketConfigurer {
-
+ @Bean
+ public XMPPConnection xmpp() {
+ return new XMPPConnection();
+ }
@Bean
public WebsocketComponent wsHandler() {
return new WebsocketComponent();
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 c79ea924..aca3cd47 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
@@ -30,12 +30,12 @@ public class WebsocketInitializer extends AbstractAnnotationConfigDispatcherServ
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class<?>[]{ };
+ return new Class<?>[]{ WebsocketConfiguration.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
- return new Class<?>[]{ WebsocketConfiguration.class };
+ return null;
}
@Override