-
Notifications
You must be signed in to change notification settings - Fork 0
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
[#184] RefreshToken DB -> Redis 마이그레이션 작업 #189
Conversation
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public class RedisRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
별도의 RedisRepository를 만들어서 어디서든지 공통으로 사용할 수 있도록 구현했습니다.
final PolymorphicTypeValidator typeValidator = BasicPolymorphicTypeValidator.builder() | ||
.allowIfBaseType(Object.class) | ||
.build(); | ||
|
||
final ObjectMapper objectMapper = new ObjectMapper(); | ||
objectMapper.registerModule(new JavaTimeModule()); | ||
objectMapper.activateDefaultTyping(typeValidator, ObjectMapper.DefaultTyping.NON_FINAL); | ||
|
||
final GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer( | ||
objectMapper); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redis에 LocalDateTime의 형태를 저장할 때 직렬화, 역직렬화하게 되면 오류가 발생합니다.
위와 같이 ObjectMapper에 JavaTimeModule을 추가하면 문제 없이 사용할 수 있습니다.
5f45c1c
to
792bb29
Compare
Kudos, SonarCloud Quality Gate passed! |
👨💻 작업 사항
📑 PR 개요
✅ 작업 목록
🙏 리뷰어에게
환경 별 Redis 서버 사용
회원 로그인 관련된 테스트 코드를 실행할 때마다 Redis에 RegisterToken이 생성되는데 TTL로 설정되어있어서 크게 무리가 가지는 않을 것 같습니다!
테이블 명
API endpoint
POST
/membersGET
/auth/loginPOST
/auth/refreshDELETE
/auth/logoutPrefix
P1
: 꼭 반영해주세요 (Request changes)P2
: 적극적으로 고려해주세요 (Request changes)P3
: 웬만하면 반영해 주세요 (Comment)P4
: 반영해도 좋고 넘어가도 좋습니다 (Approve)P5
: 그냥 사소한 의견입니다 (Approve)