aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-16 01:04:24 +0300
committerGravatar Vitaly Takmazov2017-10-16 01:10:34 +0300
commit9b5db8da41d5c4c5f50012c0055b4008191cdb8f (patch)
tree7389f6dd71b5a60d98cb18437c00f8c9436421ab /juick-ws/src
parent52d1d04cc129d6df7b54bd41e882e353add0e4ce (diff)
ws: fix xmpp initialization
Diffstat (limited to 'juick-ws/src')
-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