aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost
diff options
context:
space:
mode:
Diffstat (limited to 'juick-crosspost')
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/Crosspost.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
index 8b56f86d..5dc86f27 100644
--- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
+++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
@@ -23,8 +23,6 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
import rocks.xmpp.core.XmppException;
@@ -34,6 +32,7 @@ import rocks.xmpp.core.session.XmppSessionConfiguration;
import rocks.xmpp.core.stanza.model.Message;
import rocks.xmpp.extensions.component.accept.ExternalComponent;
+import javax.annotation.PostConstruct;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.HttpsURLConnection;
@@ -46,7 +45,7 @@ import java.util.UUID;
/**
* @author Ugnich Anton
*/
-public class Crosspost implements InitializingBean, DisposableBean {
+public class Crosspost implements AutoCloseable {
final static String TWITTERURL = "https://api.twitter.com/1.1/statuses/update.json";
final static String FBURL = "https://graph.facebook.com/me/feed";
final static String VKURL = "https://api.vk.com/method/wall.post";
@@ -85,8 +84,8 @@ public class Crosspost implements InitializingBean, DisposableBean {
return ret;
}
- @Override
- public void afterPropertiesSet() {
+ @PostConstruct
+ public void init() {
XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
.extensions(Extension.of(com.juick.Message.class))
.build();
@@ -112,7 +111,7 @@ public class Crosspost implements InitializingBean, DisposableBean {
}
@Override
- public void destroy() throws Exception {
+ public void close() throws Exception {
if (xmpp != null)
xmpp.close();