-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy: 더미데이터 실행 과정 중 initial()과 saveRefreshTokenToRedis() 메서드 실행을 별도…
…의 트랜잭션으로 관리 (#113) deploy: 더미데이터 실행 별도의 트랜잭션에서 수행
- Loading branch information
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import com.example.sinitto.sinitto.repository.SinittoBankInfoRepository; | ||
import org.springframework.boot.CommandLineRunner; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.time.LocalDate; | ||
|
@@ -72,13 +73,13 @@ public InitialData(MemberRepository memberRepository, SeniorRepository seniorRep | |
} | ||
|
||
@Override | ||
@Transactional | ||
public void run(String... args) { | ||
initial(); | ||
saveRefreshTokenToRedis(); | ||
} | ||
|
||
private void saveRefreshTokenToRedis() { | ||
@Transactional(propagation = Propagation.REQUIRES_NEW) | ||
protected void saveRefreshTokenToRedis() { | ||
System.out.println("---------------[더미데이터] 멤버별 RefreshToken---------------"); | ||
System.out.printf("시니또1 김철수(MemberId : 1)의 refreshToken : %s%n", tokenService.generateRefreshToken("[email protected]")); | ||
System.out.printf("시니또2 김유진(MemberId : 2)의 refreshToken : %s%n", tokenService.generateRefreshToken("[email protected]")); | ||
|
@@ -93,7 +94,8 @@ private void saveRefreshTokenToRedis() { | |
System.out.println("----------------------------------------------------------"); | ||
} | ||
|
||
private void initial() { | ||
@Transactional | ||
protected void initial() { | ||
//시니또 | ||
Member memberSinitto1 = memberRepository.save(new Member("김철수", "01012345678", "[email protected]", true)); | ||
sinittoBankInfoRepository.save(new SinittoBankInfo("신한은행", "123-23-444-422", memberSinitto1)); | ||
|