From 29c5c55458c9c30f305ceaea17111e3cf8335c6d Mon Sep 17 00:00:00 2001 From: BGuga Date: Tue, 26 Sep 2023 14:23:01 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20local=20prod,=20dev=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=97=90=EC=84=9C=EB=A7=8C=20FCM=20Bean=20=EB=93=A4?= =?UTF-8?q?=EC=9D=B4=20=EC=83=9D=EC=84=B1=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/festago/fcm/application/AuthEventListener.java | 6 +++--- .../fcm/application/FCMNotificationEventListener.java | 2 +- .../java/com/festago/fcm/application/MemberFCMService.java | 2 ++ backend/src/main/java/com/festago/fcm/config/FCMConfig.java | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/com/festago/fcm/application/AuthEventListener.java b/backend/src/main/java/com/festago/fcm/application/AuthEventListener.java index 3c4719d64..87d4e42f9 100644 --- a/backend/src/main/java/com/festago/fcm/application/AuthEventListener.java +++ b/backend/src/main/java/com/festago/fcm/application/AuthEventListener.java @@ -5,7 +5,7 @@ import com.festago.fcm.domain.MemberFCM; import com.festago.fcm.repository.MemberFCMRepository; import java.util.List; -import org.springframework.context.event.EventListener; +import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -13,6 +13,7 @@ import org.springframework.transaction.event.TransactionalEventListener; @Component +@Profile({"dev", "prod"}) public class AuthEventListener { private final MemberFCMRepository memberFCMRepository; @@ -21,8 +22,7 @@ public AuthEventListener(MemberFCMRepository memberFCMRepository) { this.memberFCMRepository = memberFCMRepository; } - @Transactional - @EventListener + @TransactionalEventListener public void saveMemberFCM(MemberLoginEvent memberLoginEvent) { Long memberId = memberLoginEvent.memberId(); deleteFCM(memberId); diff --git a/backend/src/main/java/com/festago/fcm/application/FCMNotificationEventListener.java b/backend/src/main/java/com/festago/fcm/application/FCMNotificationEventListener.java index 36fb9dd95..3cacbf213 100644 --- a/backend/src/main/java/com/festago/fcm/application/FCMNotificationEventListener.java +++ b/backend/src/main/java/com/festago/fcm/application/FCMNotificationEventListener.java @@ -21,8 +21,8 @@ import org.springframework.transaction.event.TransactionPhase; import org.springframework.transaction.event.TransactionalEventListener; -@Profile("!test") @Component +@Profile({"dev", "prod"}) public class FCMNotificationEventListener { private static final Logger logger = LoggerFactory.getLogger(FCMNotificationEventListener.class); diff --git a/backend/src/main/java/com/festago/fcm/application/MemberFCMService.java b/backend/src/main/java/com/festago/fcm/application/MemberFCMService.java index 81198f2b7..d8a21db41 100644 --- a/backend/src/main/java/com/festago/fcm/application/MemberFCMService.java +++ b/backend/src/main/java/com/festago/fcm/application/MemberFCMService.java @@ -8,11 +8,13 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @Transactional +@Profile({"prod", "dev"}) public class MemberFCMService { private static final Logger logger = LoggerFactory.getLogger(MemberFCMService.class); diff --git a/backend/src/main/java/com/festago/fcm/config/FCMConfig.java b/backend/src/main/java/com/festago/fcm/config/FCMConfig.java index 82ae17cdf..93b3dfab2 100644 --- a/backend/src/main/java/com/festago/fcm/config/FCMConfig.java +++ b/backend/src/main/java/com/festago/fcm/config/FCMConfig.java @@ -14,7 +14,7 @@ import org.springframework.core.io.ClassPathResource; @Configuration -@Profile("!test") +@Profile({"prod", "dev"}) public class FCMConfig { @Value("${fcm.key.path}")