본문 바로가기

전체 글12

LocalDateTime의 직렬화 및 역직렬화 실패 이슈 @DateTimeFormat의 deserialize 실패 문제상황 { "timestamp": "2023-04-11T16:33:28.312+00:00", "status": 400, "error": "Bad Request", "trace": "org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String \\"2023-04-10'T'10:48:12\\": Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParse.. 2023. 4. 12.
Mapper 클래스 구현 방법에 대한 고찰 MapStruct 도입에 대한 고찰 문제 상황 Mapper 클래스를 직접 만들기가 수고로움 코드를 통해 Mapper 클래스의 생성을 자동화 할 수 없을까? 가능한 방법 직접 Mapper Class를 작성하기 장점 순수한 자바 코드이기 때문에 외부 라이브러리를 가져와서 발생할 수 있는 기타 여러 가지 문제들로부터 자유로움 단점 직접 손으로 코드를 작성해야 하기에 휴먼 에러가 발생할 수 있음 일종의 하드코딩이기 때문에 모듈 간의 결합도가 높아질 수 있음 MapStruct 장점 컴파일 시에 Mapper 클래스의 로직이 생성되기 때문에 어노테이션 등을 이용하여 간단하게 Mapper 클래스를 생성할 수 있다. 즉, 생산성을 높일 수 있다 단점 상수는 매핑 시키지 못한다 Lombok과 충돌할 수 있다. ModelM.. 2023. 4. 10.
Request를 VO가 아닌 DTO로 구현하는 이유 Chat GPT which way is better between implement request as dto and as vo? Both DTO (Data Transfer Object) and VO (Value Object) are commonly used to transfer data between layers or modules of an application. However, they have slightly different purposes and use cases.A DTO is typically used to transfer data between layers of an application or between different applications, and it is often used .. 2023. 4. 10.
"User", "Member"를 클래스 이름으로 사용하면 안 되는 이유 is it good for developer to use "User" as the name of entity class? is it good for developer to use "Member" as the name of entity class? “User”란 이름은 예약어로 사용될 가능성이 높기 때문에 되도록이면 사용하지 않는 것을 추천함. 따라서 사용자를 저장하는 클래스의 엔티티의 이름을 “User”로 하지 않는다. 이외에도 Member란 클래스의 이름도 같은 이유로 추천되는 이름은 아니다. 이것들의 대용으로 다음 같은 클래스 이름을 사용할 수 있다. “UserEntity” “MemberEntity” 2023. 4. 10.