Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] fix: 트랜잭션 전파 옵션을 설정 #300

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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;
Expand All @@ -19,7 +21,7 @@ public MemberService(final MemberRepository memberRepository) {
this.memberRepository = memberRepository;
}

@Transactional
@Transactional(propagation = REQUIRES_NEW)
public SignUserDto findOrCreateMember(final UserInfoDto userInfoDto) {
final String platformId = userInfoDto.getId().toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class MemberServiceTest {

@Autowired
private MemberService memberService;
private TestMemberService memberService;

@Autowired
private MemberRepository memberRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.funeat.member.application;

import com.funeat.auth.dto.SignUserDto;
import com.funeat.auth.dto.UserInfoDto;
import com.funeat.member.persistence.MemberRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class TestMemberService extends MemberService {

public TestMemberService(final MemberRepository memberRepository) {
super(memberRepository);
}

@Override
@Transactional
public SignUserDto findOrCreateMember(final UserInfoDto userInfoDto) {
return super.findOrCreateMember(userInfoDto);
}
}
Loading