로컬캐시_실습
로컬캐시_실습
해봐야겠다고 판단한 영역
[ ] 카페인 기능 테스트 [ ] 상품쪽 테스트 작성.
디버깅 타입 불일치 이슈
CachePut 및 Cacheable 어노테이션은 Spring에서 캐싱을 관리하는 데 사용됩니다. 발생한 ClassCastException은 캐시된 데이터와 조회 시 예상되는 데이터 타입 간의 불일치로 인해 발생합니다. CategoryService 클래스에서 CachePut 메서드는 Category 객체를 캐싱하고, Cacheable 메서드 findCategoryOneV3는 FindCategoryItemResponse 객체를 기대하고 있습니다. 이 타입 불일치가 ClassCastException을 유발합니다. 이 문제를 해결하려면 캐시된 데이터 타입이 일관되도록 해야 합니다. 이를 위해 Category 객체 대신 FindCategoryItemResponse 객체를 캐싱할 수 있습니다. Category 객체를 FindCategoryItemResponse로 변환한 후 캐싱하면 됩니다. 다음은 updateCategoryWriteThrough 및 updateCategoryWriteBack 메서드를 FindCategoryItemResponse 객체를 캐싱하도록 수정한 예제입니다:
Trouble Shooting Java 8 date/time type java.time.LocalDateTime not supported by default 라는 오류는
LocalDataTime을 역직렬화하지 못해서 생기는 오류이다.
gradle에 아래와 같이 추가하고
//자바 역직렬화 문제 해결 패키지
This post is licensed under CC BY 4.0 by the author.