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

[Refactor/421] Redis 직렬화/역직렬화 리팩토링 #422

Merged
merged 5 commits into from
Dec 3, 2024
Merged

Conversation

hosung-222
Copy link
Member

Type of change

  • Feature : 새로운 기능 추가
  • Bug fix : 버그 수정
  • Refactor : 코드 리팩토링 작업
  • Document : 문서작업
  • Test : 테스트 코드 작성 및 테스트 작업
  • Style : 코드 스타일 및 포맷팅 작업
  • CI/CD : CI/CD 작업 수정
  • Chore : 패키지 매니저, 라이브러리 업데이트 등의 작업

PR Desciption

변경 사항 설명

  • 기존 개별 값들에 대해 각각 직렬화/역직렬화를 지정해주어야 했던 로직을 개선했습니다.

    • CustomObjectMapper를 만들고 bean등록을 통해 Redis 직렬화/역직렬화에 사용
    • 이때 Class 정보가 포함되기 때문에 기본 ObjectMapper 추가 생성
    • .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 값을 통해 format 통일

    결과 : 기존 값들의 직렬화/역직렬화 중복 코드 삭제

++ hotfix : member 생성시 생일 검증 로직이 해제되었습니다. -> 최초 기본생성시 생일 없음.

PR Log

PR 작업하면서 고민했던 내용, 해결한 내용, 고민 중인 내용 등

새롭게 배운 것

  • .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) 를 통해 LocalDate관련 값들이 List로 반환되는 것을 TIMESTAMPS format으로 지정가능합니다.
  • ObjectMapper를 bean으로 만들어 등록할 경우 redis를 제외한 모든 경우에 해당 mapper 설정이 적용되므로 기본 mapper가 필요합니다.
  • 공용으로 Object를 받아 처리할 경우 다형성(Polymorphic) 타입의 직렬화와 역직렬화를 안전하게 처리하기 위한 타입 검증기가 필요합니다. (PolymorphicTypeValidator)

고민 중인 사항

  • RedisConfig에 대해 더 공부하고 깔끔하게 다듬을 필요가 있습니다.

첨부 자료

관련 이슈

Redis의 gradle로 이동

- 관련 : #421
최소 생성시 생일 값 X

- 관련 : #421
class type 정보와 JavaTimeModule을 포함한 CustomObjectMapper 빈 등록

- 관련 : #421
기본 ObjectMapper 명시

- 관련 : #421
CustomObjectMapper로 처리하여 리팩토링

- 관련 : #421
@hosung-222 hosung-222 requested a review from joowojr December 1, 2024 14:47
@hosung-222 hosung-222 self-assigned this Dec 1, 2024
@hosung-222 hosung-222 linked an issue Dec 1, 2024 that may be closed by this pull request
10 tasks
@github-actions github-actions bot added the ♻️ refactor 리펙터링 관련 label Dec 1, 2024
Copy link
Contributor

@joowojr joowojr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!
커스텀 object mapper을 선언한 것이 깔끔하고 유지보수에 좋아보이네요

@joowojr joowojr merged commit 1f83114 into dev Dec 3, 2024
3 checks passed
@joowojr joowojr deleted the refactor/421 branch December 3, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♻️ refactor 리펙터링 관련
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] LocalDateTime 직렬화 로직 리팩토링
2 participants