From 6d1e79d97573218b51053d41af4f9328a1e6921f Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Wed, 30 Nov 2016 15:33:13 +0700 Subject: notification properties are added to example configuration --- .../configuration/NotificationsAppConfiguration.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'juick-notifications/src/main/java') diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java index ff3a5a5a..67a551c4 100644 --- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java +++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java @@ -1,12 +1,10 @@ package com.juick.components.configuration; import com.juick.components.Notifications; -import com.juick.configuration.DataConfiguration; import com.notnoop.apns.APNS; import com.notnoop.apns.ApnsService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -30,10 +28,11 @@ public class NotificationsAppConfiguration { @Bean public RestTemplate rest() { RestTemplate rest = new RestTemplate(); - List interceptors = Collections - .singletonList( - new BasicAuthorizationInterceptor(env.getProperty("api_user", "juick"), - env.getProperty("api_password", "secret"))); + List interceptors = Collections.singletonList( + new BasicAuthorizationInterceptor( + env.getProperty("api_user", "juick"), + env.getProperty("api_password", "secret"))); + rest.setRequestFactory(new InterceptingClientHttpRequestFactory(rest.getRequestFactory(), interceptors)); return rest; } @@ -42,6 +41,7 @@ public class NotificationsAppConfiguration { public Notifications push() { return new Notifications(env, rest()); } + @Bean public ApnsService apns() { return APNS.newService().withCert(env.getProperty("ios_pkcs12_file"), env.getProperty("ios_pkcs12_password")) -- cgit v1.2.3