From 37a29c5fc6ea08a320d018404ece8f23a4a74b38 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 15 Oct 2018 15:26:55 +0300 Subject: fix classpath resource search --- .../src/main/java/com/juick/components/FirebaseManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'juick-notifications/src/main/java') diff --git a/juick-notifications/src/main/java/com/juick/components/FirebaseManager.java b/juick-notifications/src/main/java/com/juick/components/FirebaseManager.java index a150c010..e2ffd9d5 100644 --- a/juick-notifications/src/main/java/com/juick/components/FirebaseManager.java +++ b/juick-notifications/src/main/java/com/juick/components/FirebaseManager.java @@ -14,6 +14,8 @@ import com.juick.service.component.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import javax.annotation.PostConstruct; import javax.inject.Inject; @@ -35,11 +37,11 @@ public class FirebaseManager implements NotificationListener { @PostConstruct public void initialize() throws IOException { - InputStream serviceAccount = - ClassLoader.class.getResourceAsStream("serviceAccount.json"); + Resource serviceAccount = + new ClassPathResource("serviceAccount.json"); FirebaseOptions options = new FirebaseOptions.Builder() - .setCredentials(GoogleCredentials.fromStream(serviceAccount)) + .setCredentials(GoogleCredentials.fromStream(serviceAccount.getInputStream())) .setDatabaseUrl(fcmDatabaseUrl) .build(); -- cgit v1.2.3