diff options
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/configuration')
-rw-r--r-- | juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java | 29 |
1 files changed, 11 insertions, 18 deletions
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 |