I have a request that has a page object.
`@Data public class GetProductListRequest {
private String keyword;
private int categoryId;
private String productCode;
private Page page;
}`
` @NoArgsConstructor @AllArgsConstructor @Data public class Page {
private static final int DEFAULT_PAGE_SIZE = 20;
private int pageNum = 1;
@Min(10)
@Max(50)
private int pageSize = DEFAULT_PAGE_SIZE;
private int totalCount = 0;
private int totalPageCount = 1;
}`
When I request with page {"pageNum": 2, "pageSize": 20}, the RequestBody is correct. However, the problem is, when I request with {"pageNum": 2, "pageSize": 20, "totalCount": 0, "totalPageCount": 1}, the server perceives it as {"pageNum": 1, "pageSize": 20, "totalCount": 0, "totalPageCount": 0}. The pageNum is wrong.
It is not the problem of initial values of the Page class. I have tried removing them and I still get the wrong pageNum.
I am using spring-boot 2.7.6, which uses spring of version 5.3.24.
Comment From: SeakyLuo
mistaken report