diff options
Diffstat (limited to 'juick-notifications/src/main/java/com/juick')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/Notifications.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java index ea428a2d..ebc69bd1 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -38,8 +38,6 @@ import org.apache.http.util.TextUtils; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.env.Environment; import org.springframework.http.HttpMethod; @@ -49,6 +47,7 @@ import rocks.xmpp.core.session.Extension; import rocks.xmpp.core.session.XmppSessionConfiguration; import rocks.xmpp.extensions.component.accept.ExternalComponent; +import javax.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -57,7 +56,7 @@ import java.util.List; /** * @author Ugnich Anton */ -public class Notifications implements InitializingBean, DisposableBean { +public class Notifications implements AutoCloseable { private static Logger logger = LoggerFactory.getLogger(Notifications.class); private final RestTemplate rest; @@ -84,8 +83,8 @@ public class Notifications implements InitializingBean, DisposableBean { xmppPushPassword = env.getProperty("push_xmpp_password", ""); } - @Override - public void afterPropertiesSet() { + @PostConstruct + public void init() { XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() .extensions(Extension.of(com.juick.Message.class)) .build(); @@ -211,7 +210,7 @@ public class Notifications implements InitializingBean, DisposableBean { } @Override - public void destroy() throws Exception { + public void close() throws Exception { if (xmpp != null) xmpp.close(); |