From d1272705c137ed6521ad7c4ebded4700c5a71cba Mon Sep 17 00:00:00 2001 From: Dabeen Jeong Date: Thu, 3 Aug 2023 15:05:51 +0900 Subject: [PATCH] =?UTF-8?q?[BE]=20refactor:=20=ED=8A=B8=EB=9E=9C=EC=9E=AD?= =?UTF-8?q?=EC=85=98=EC=9D=84=20=ED=8C=80=20=EC=BB=A8=EB=B2=A4=EC=85=98?= =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EB=A6=AC=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A7=81=20(#291)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/funeat/auth/application/AuthService.java | 2 +- .../java/com/funeat/member/application/MemberService.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/com/funeat/auth/application/AuthService.java b/backend/src/main/java/com/funeat/auth/application/AuthService.java index e78864b36..0918aa601 100644 --- a/backend/src/main/java/com/funeat/auth/application/AuthService.java +++ b/backend/src/main/java/com/funeat/auth/application/AuthService.java @@ -8,7 +8,7 @@ import org.springframework.transaction.annotation.Transactional; @Service -@Transactional +@Transactional(readOnly = true) public class AuthService { private final MemberService memberService; diff --git a/backend/src/main/java/com/funeat/member/application/MemberService.java b/backend/src/main/java/com/funeat/member/application/MemberService.java index 6702a1ef1..086bcafc6 100644 --- a/backend/src/main/java/com/funeat/member/application/MemberService.java +++ b/backend/src/main/java/com/funeat/member/application/MemberService.java @@ -1,7 +1,5 @@ package com.funeat.member.application; -import static org.springframework.transaction.annotation.Propagation.REQUIRES_NEW; - import com.funeat.auth.dto.SignUserDto; import com.funeat.auth.dto.UserInfoDto; import com.funeat.member.domain.Member; @@ -12,7 +10,7 @@ import org.springframework.transaction.annotation.Transactional; @Service -@Transactional +@Transactional(readOnly = true) public class MemberService { private final MemberRepository memberRepository; @@ -21,6 +19,7 @@ public MemberService(final MemberRepository memberRepository) { this.memberRepository = memberRepository; } + @Transactional public SignUserDto findOrCreateMember(final UserInfoDto userInfoDto) { final String platformId = userInfoDto.getId().toString(); @@ -29,8 +28,7 @@ public SignUserDto findOrCreateMember(final UserInfoDto userInfoDto) { .orElseGet(() -> save(userInfoDto)); } - @Transactional(propagation = REQUIRES_NEW) - public SignUserDto save(final UserInfoDto userInfoDto) { + private SignUserDto save(final UserInfoDto userInfoDto) { final Member member = userInfoDto.toMember(); memberRepository.save(member);