From 95ac207e5dd5566490571fda7229b754a2bbe7ac Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 24 Oct 2016 14:06:17 +0300 Subject: ws: fix injections --- .../ws/configuration/WebsocketConfiguration.java | 29 ++++++++-------------- 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'juick-ws/src/main/java/com/juick/ws/configuration') 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 3b75028e..a05457fa 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 @@ -34,6 +34,8 @@ import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry import javax.inject.Inject; import javax.servlet.ServletContext; import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * Created by vitalyster on 28.06.2016. @@ -46,13 +48,7 @@ public class WebsocketConfiguration extends WebMvcConfigurationSupport implement @Inject Environment env; @Inject - XMPPComponent ws; - @Inject - CrosspostComponent crosspost; - @Inject - PushComponent push; - @Inject - XMPPConnection xmpp; + ExecutorService service; @Bean WebsocketComponent wsHandler() { return new WebsocketComponent(); @@ -96,26 +92,23 @@ public class WebsocketConfiguration extends WebMvcConfigurationSupport implement } @Bean public XMPPConnection ws() { - XMPPConnection ws = new XMPPConnection(env); - ws.init(); - return ws; + return new XMPPConnection(env, service); } @Bean public XMPPComponent xmpp() { - XMPPComponent xmpp = new XMPPComponent(env); - return xmpp; + return new XMPPComponent(env, service); } @Bean public CrosspostComponent crosspost() { - CrosspostComponent crosspost = new CrosspostComponent(env); - crosspost.init(); - return crosspost; + return new CrosspostComponent(env, service); } @Bean public PushComponent push() { - PushComponent push = new PushComponent(env); - push.init(); - return push; + return new PushComponent(env, service); + } + @Bean + public ExecutorService service() { + return Executors.newCachedThreadPool(); } @Override -- cgit v1.2.3