| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 2026추석연휴
- 자바
- 리눅스
- 알고리즘
- 이진트리
- 자료구조
- spring boot
- level1
- 객체지향
- GH공공임대
- 알고리즘 인터뷰
- JPA
- 리트코드
- 항해
- 프로그래머스
- Java
- Spring
- 임대주택공고
- 코딩테스트
- 파이썬
- 백준
- 파이썬 알고리즘 인터뷰
- TiL
- 설치
- SQL
- ORM
- ssh
- 톰캣
- CS
- 회고
Archives
- Today
- Total
IT 전문가의 생활정보 돋보기
No primary or single unique constructor found for interface org.springframework.data.domain.Pageable 본문
트러블 슈팅
No primary or single unique constructor found for interface org.springframework.data.domain.Pageable
정보_돋보기 2022. 7. 8. 13:08반응형
문제 발생 배경
@ApiOperation(value = "전체 게시글 목록 조회")
@ApiImplicitParams({
@ApiImplicitParam(name = "filter", value = "카테고리(daily/challenge/my)", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "keyword", value = "검색 키워드", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "pageable", value = "페이징 값(size, page, sort)", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "sub", value = "(제목/내용으로 검색)title/content", required = false, dataType = "string", paramType = "query")
})
@ApiImplicitParam(name = "Authorization", value = "Access Token", required = true, allowEmptyValue = false, paramType = "header", dataTypeClass = String.class, example = "access_token")
@GetMapping("/board")
public ResponseEntity<PageBoardResponseDto> getBoardList(
@RequestParam(required = false) FilterEnum filter,
@RequestParam(defaultValue = "") String keyword,
@RequestParam(required = false) SubEnum sub,
@PageableDefault(size=10, sort="createdDate", direction= Sort.Direction.DESC) Pageable pageable
) {
LoadUser.loginAndNickCheck();
PageBoardResponseDto responseDto = boardService.getBoardList(
filter, keyword, pageable, LoadUser.getEmail(), sub
);
return ResponseEntity.status(HttpStatus.OK).body(responseDto);
}
전체 게시글 목록과 검색을 같이하는 API를 작성중에,
No primary or single unique constructor found for interface org.springframework.data.domain.Pageable
해당 오류가 발생했다.
발생원인파악
No primary or default constructor found for interface org.springframework.data.domain.Pageable
I was trying to implement Pageable in my RestController and running into issues with this error message "No primary or default constructor found for interface org.springframework.data.domain.Pageab...
stackoverflow.com
Swagger config 클래스에 Pageable 을 파라미터로 받을 수 있게 설정해야한다는 내용이 있었다.
그래서 해당 페이지에서 나온데로 Swagger config에 아래 메소드를 추가해 주었다.
오류 해결
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add( new PageableHandlerMethodArgumentResolver());
}반응형
'트러블 슈팅' 카테고리의 다른 글
| assertThat().extracting().containsExactly() error (0) | 2022.07.10 |
|---|---|
| [WARN]firstResult/maxResults specified with collection fetch; applying in memory! (0) | 2022.07.08 |
Comments