From 579f86261b006c7c50e91722cc2db1d9494f01d8 Mon Sep 17 00:00:00 2001 From: sangminee Date: Mon, 11 Mar 2024 14:55:42 +0900 Subject: [PATCH] =?UTF-8?q?[CHORE]=20=ED=8C=8C=EC=9D=BC=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/oya/kr/chat/config/FCMInitializer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/oya/kr/chat/config/FCMInitializer.java b/src/main/java/com/oya/kr/chat/config/FCMInitializer.java index 0cbb52e..6a24ec7 100644 --- a/src/main/java/com/oya/kr/chat/config/FCMInitializer.java +++ b/src/main/java/com/oya/kr/chat/config/FCMInitializer.java @@ -9,6 +9,7 @@ import javax.annotation.PostConstruct; +import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.core.io.InputStreamResource; @@ -44,14 +45,11 @@ public class FCMInitializer { public void initialize() throws IOException { if (!initialized) { try { - // EC2 root 디렉토리에 있는 파일에 접근하기 위해 FileSystemResource를 사용 - Resource resource = new FileSystemResource("/home/ubuntu/firebase.json"); + Resource resource = new ClassPathResource("firebase.json"); byte[] jsonBytes = getJsonBytes(resource); String jsonContent = new String(jsonBytes, StandardCharsets.UTF_8); - log.info("Firebase JSON 파일 내용:\n{}", jsonContent); - GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new ByteArrayInputStream(jsonBytes)) .createScoped(Arrays.asList("https://www.googleapis.com/auth/cloud-platform")); FirebaseOptions options = new FirebaseOptions.Builder()