aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src')
-rw-r--r--juick-api/src/main/java/com/juick/api/ApiServer.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/juick-api/src/main/java/com/juick/api/ApiServer.java b/juick-api/src/main/java/com/juick/api/ApiServer.java
index 110d8e2f..d7862952 100644
--- a/juick-api/src/main/java/com/juick/api/ApiServer.java
+++ b/juick-api/src/main/java/com/juick/api/ApiServer.java
@@ -24,6 +24,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationListener;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import rocks.xmpp.addr.Jid;
@@ -38,6 +41,7 @@ import rocks.xmpp.extensions.oob.model.x.OobX;
import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import javax.servlet.ServletContext;
import java.net.URI;
import java.net.URISyntaxException;
@@ -60,11 +64,7 @@ public class ApiServer implements ApplicationListener<DisconnectedEvent>, AutoCl
@Value("${xmpp_disabled:false}")
private boolean isXmppDisabled;
@Inject
- private WebSocketConnectionManager webSocketConnectionManager;
- @Inject
- private StandardWebSocketClient client;
- @Inject
- private DefaultListableBeanFactory beanFactory;
+ private ServletContext servletContext;
@PostConstruct
public void init() {
@@ -122,8 +122,8 @@ public class ApiServer implements ApplicationListener<DisconnectedEvent>, AutoCl
@Override
public void onApplicationEvent(@Nonnull DisconnectedEvent event) {
- logger.info("reconnecting websocket...");
- beanFactory.destroySingleton("client");
- beanFactory.destroySingleton("webSocketConnectionManager");
+ logger.info("reloading app...");
+ WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
+ ((AbstractApplicationContext) context).refresh();
}
}