From 1a216bcaee482fb7b29d869b8c556cf1548ee97e Mon Sep 17 00:00:00 2001 From: kanguk Date: Fri, 1 Nov 2024 11:10:45 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20FCM=20=EC=B4=88=EA=B8=B0=ED=99=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이후 배포 테스트 --- .../splanet/core/fcm/FCMInitializer.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/splanet/splanet/core/fcm/FCMInitializer.java b/src/main/java/com/splanet/splanet/core/fcm/FCMInitializer.java index 5e503d5c..4766ba67 100644 --- a/src/main/java/com/splanet/splanet/core/fcm/FCMInitializer.java +++ b/src/main/java/com/splanet/splanet/core/fcm/FCMInitializer.java @@ -19,15 +19,19 @@ public class FCMInitializer { @PostConstruct public void initialize() { try { - GoogleCredentials googleCredentials = GoogleCredentials - .fromStream(new ClassPathResource(FIREBASE_CONFIG_PATH).getInputStream()); - FirebaseOptions options = new FirebaseOptions.Builder() - .setCredentials(googleCredentials) - .build(); - FirebaseApp.initializeApp(options); + if (FirebaseApp.getApps().isEmpty()) { + GoogleCredentials googleCredentials = GoogleCredentials + .fromStream(new ClassPathResource(FIREBASE_CONFIG_PATH).getInputStream()); + FirebaseOptions options = new FirebaseOptions.Builder() + .setCredentials(googleCredentials) + .build(); + FirebaseApp.initializeApp(options); + log.info("FirebaseApp 초기화 완료"); + } else { + log.info("FirebaseApp이 이미 초기화되었습니다."); + } } catch (IOException e) { - log.info("FCM initialization error occurred."); - log.error("FCM error message : " + e.getMessage()); + log.error("FCM 초기화 오류 발생: " + e.getMessage()); } } -} \ No newline at end of file +}