Skip to content

Commit e2d75dc

Browse files
committed
[Feat]: 페이지 설정 빈 등록
- 요청 시작 1, 최대 사이즈 50, 기본 사이즈 5
1 parent d7c1241 commit e2d75dc

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.back.global.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.data.domain.PageRequest;
6+
import org.springframework.data.web.config.PageableHandlerMethodArgumentResolverCustomizer;
7+
8+
/**
9+
* 웹 관련 설정을 정의하는 구성 클래스.
10+
*/
11+
@Configuration
12+
public class WebConfig {
13+
14+
// 스프링의 페이지 요청을 1부터 시작하도록 설정
15+
// 최대 페이지 크기 및 기본 페이지 설정
16+
@Bean
17+
public PageableHandlerMethodArgumentResolverCustomizer customizer() {
18+
return pageableResolver -> {
19+
pageableResolver.setOneIndexedParameters(true); // page 요청이 1로 오면 0으로 인식
20+
pageableResolver.setMaxPageSize(50);
21+
pageableResolver.setFallbackPageable(PageRequest.of(0, 5));
22+
};
23+
}
24+
}

0 commit comments

Comments
 (0)