aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src')
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java11
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java2
2 files changed, 13 insertions, 0 deletions
diff --git a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java
index 35377dcd..a54b76a1 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java
@@ -1,11 +1,22 @@
package com.juick.www.configuration;
+import com.juick.server.XMPPConnection;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
+import rocks.xmpp.extensions.component.accept.ExternalComponent;
+
+import javax.inject.Inject;
@Configuration
@ConditionalOnClass(name = "com.juick.server.xmpp.router.XMPPRouter")
@ComponentScan(basePackages = "com.juick.server")
public class EmbeddedXMPPConfig {
+ @Inject
+ private XMPPConnection xmppConnection;
+ @Bean
+ public ExternalComponent xmpp() {
+ return xmppConnection.getRouter();
+ }
}
diff --git a/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java
index 0fc86e2a..c8efc9e9 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java
@@ -4,6 +4,7 @@ import com.juick.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import rocks.xmpp.core.XmppException;
@@ -26,6 +27,7 @@ public class XMPPConfiguration {
@Value("${xmpp_disabled:false}")
private boolean isXmppDisabled;
@Bean
+ @ConditionalOnMissingBean(type = "rocks.xmpp.extensions.component.accept.ExternalComponent")
public ExternalComponent xmpp() {
XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
.extensions(Extension.of(Message.class))