diff options
author | Vitaly Takmazov | 2018-10-15 15:26:55 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-10-15 15:26:55 +0300 |
commit | 37a29c5fc6ea08a320d018404ece8f23a4a74b38 (patch) | |
tree | b56652c6a676a2133c42fb1c61ebc378fe8431ed /juick-notifications/src/main/java/com/juick | |
parent | 25b8b611abbf99e125515c84925487b2a7abeb89 (diff) |
fix classpath resource search
Diffstat (limited to 'juick-notifications/src/main/java/com/juick')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/FirebaseManager.java | 8 |
1 files changed, 5 insertions, 3 deletions
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(); |