i did dto Object Cache. error occurred code.
public record EventListCopyResponse(
Long eventCode,
String title,
String content,
String image,
String thumbnail,
String link,
MemberRole role,
LocalDateTime createdAt,
LocalDateTime updatedAt
) {
}
@Override
@Cacheable("event")
public List<EventListCopyResponse> execute(MemberRole role) {
List<Event> events = loadEventService.findAllByMemberRole(role);
return eventMapper.toEventListResponse(events);
}
error occurred this code.
java.io.InvalidClassException: com.chaorda.matchuum.api.presentation.information.event.model.response.EventListCopyResponse; class invalid for deserialization
so i did record class implements Serialization
public record EventListCopyResponse(
Long eventCode,
String title,
String content,
String image,
String thumbnail,
String link,
MemberRole role,
LocalDateTime createdAt,
LocalDateTime updatedAt
) implements Serializable {
}
then is works.
as far as I know, java record class already implements Serializable, so why does it have to be implemented explicitly for it to work?