From 930b3f29f788d7866d66fcb9e946f5947782d968 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 8 Aug 2016 11:01:02 +0300 Subject: juick-ws: components as async beans --- .../ws/configuration/WebsocketConfiguration.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (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 92b61bc7..086ae4ce 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 @@ -3,6 +3,10 @@ package com.juick.ws.configuration; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.juick.ws.WebsocketComponent; +import com.juick.ws.XMPPConnection; +import com.juick.ws.components.CrosspostComponent; +import com.juick.ws.components.PushComponent; +import com.juick.ws.components.XMPPComponent; import com.mitchellbosecke.pebble.PebbleEngine; import com.mitchellbosecke.pebble.loader.Loader; import com.mitchellbosecke.pebble.loader.ServletLoader; @@ -41,6 +45,14 @@ import java.util.List; public class WebsocketConfiguration extends WebMvcConfigurationSupport implements WebSocketConfigurer { @Inject Environment env; + @Inject + XMPPComponent ws; + @Inject + CrosspostComponent crosspost; + @Inject + PushComponent push; + @Inject + XMPPConnection xmpp; @Bean WebsocketComponent wsHandler() { return new WebsocketComponent(); @@ -82,6 +94,30 @@ public class WebsocketConfiguration extends WebMvcConfigurationSupport implement viewResolver.setPebbleEngine(pebbleEngine()); return viewResolver; } + @Bean + public XMPPConnection ws() { + XMPPConnection ws = new XMPPConnection(); + ws.init(); + return ws; + } + @Bean + public XMPPComponent xmpp() { + XMPPComponent xmpp = new XMPPComponent(); + xmpp.init(); + return xmpp; + } + @Bean + public CrosspostComponent crosspost() { + CrosspostComponent crosspost = new CrosspostComponent(); + crosspost.init(); + return crosspost; + } + @Bean + public PushComponent push() { + PushComponent push = new PushComponent(); + push.init(); + return push; + } @Override public RequestMappingHandlerMapping requestMappingHandlerMapping() { -- cgit v1.2.3