PageImpl 을 사용할 때 필요한 조치

갓김치·2025년 1월 14일
0

Spring Boot

목록 보기
2/3

상황

warn 로그

Jan 14 10:09:17 ip-172-31-1-186 web[2739]: 250114 10:09:17 WARN o.s.d.w.c.SpringDataJacksonConfiguration$PageModule$PlainPageSerializationWarning - Serializing PageImpl instances as-is is not supported, meaning that there is no guarantee about the stability of the resulting JSON structure!
Jan 14 10:09:17 ip-172-31-1-186 web[2739]: #011For a stable JSON structure, please use Spring Data's PagedModel (globally via @EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO))

controller method

아래 list api 호출하니 위와 같은 워닝이 떴다

public Page<AdminPatientSurveyProgressListItemReadDTO> getList() {}

해결

PageImpl Serialization 때문이어서 Application 에 어노테이션을 추가해줬다

@EnableSpringDataWebSupport(pageSerializationMode = PageSerializationMode.VIA_DTO)
@SpringBootApplication
public class MyApp {
}
profile
갈 길이 멀다

0개의 댓글