diff --git a/be/src/main/java/yeonba/be/config/FcmConfig.java b/be/src/main/java/yeonba/be/config/FcmConfig.java index c491fc37..9270d0d2 100644 --- a/be/src/main/java/yeonba/be/config/FcmConfig.java +++ b/be/src/main/java/yeonba/be/config/FcmConfig.java @@ -4,26 +4,25 @@ import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseOptions; import com.google.firebase.messaging.FirebaseMessaging; -import java.io.FileInputStream; import java.io.IOException; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.Resource; +import org.springframework.core.io.ClassPathResource; @Configuration public class FcmConfig { @Value("${FCM_ACCOUNT_KEY_PATH}") - private Resource accountKey; + private String fcmAccountKeyPath; @Bean public FirebaseMessaging firebaseMessaging() throws IOException { - FileInputStream serviceAccount = new FileInputStream(accountKey.getFile()); + ClassPathResource resource = new ClassPathResource(fcmAccountKeyPath); FirebaseOptions firebaseOptions = FirebaseOptions.builder() - .setCredentials(GoogleCredentials.fromStream(serviceAccount)) + .setCredentials(GoogleCredentials.fromStream(resource.getInputStream())) .build(); return FirebaseMessaging.getInstance(FirebaseApp.initializeApp(firebaseOptions));