From f2083204b6619aa2f94eb220c417b44f9650743b Mon Sep 17 00:00:00 2001 From: Minjae-An Date: Sun, 26 May 2024 17:20:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20FirebaseApp=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94,=20=EB=94=B1=20=ED=95=9C=20=EB=B2=88=EB=A7=8C=20?= =?UTF-8?q?=EC=88=98=ED=96=89=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 테스트 코드 실행시 기본 이름(default)의 FirebaseApp이 중복 생성되는 예외 발생 - 반드시 한 번만 초기화를 수행하도록 설정 변경 --- be/src/main/java/yeonba/be/config/FcmConfig.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/be/src/main/java/yeonba/be/config/FcmConfig.java b/be/src/main/java/yeonba/be/config/FcmConfig.java index 9270d0d2..4a968734 100644 --- a/be/src/main/java/yeonba/be/config/FcmConfig.java +++ b/be/src/main/java/yeonba/be/config/FcmConfig.java @@ -19,6 +19,11 @@ public class FcmConfig { @Bean public FirebaseMessaging firebaseMessaging() throws IOException { + if (!FirebaseApp.getApps().isEmpty()) { + + return FirebaseMessaging.getInstance(FirebaseApp.getInstance()); + } + ClassPathResource resource = new ClassPathResource(fcmAccountKeyPath); FirebaseOptions firebaseOptions = FirebaseOptions.builder()