No primary or single unique constructor found
for interface org.springframework.data.domain.Pageable
아래와 같은 코드를 추가해서 해결했다.
@Configuration
class PagingConfig : WebFluxConfigurer {
override fun configureArgumentResolvers(configurer: ArgumentResolverConfigurer) {
configurer.addCustomResolver(ReactivePageableHandlerMethodArgumentResolver())
}
}
@Query("SELECT * FROM travel_destination LIMIT :limit OFFSET :offset")
suspend fun findAll(limit: Int, offset: Int): Flow<TravelDestination>
suspend fun getAllTravelDestinationList(page: Int, size: Int): TravelDestinationListResponse {
val offset = (page - 1) * size
val travelDestinationList = travelDestinationRepository.findAll(size, offset).toList()
return TravelDestinationListResponse(
travelDestinationList = travelDestinationList.map { it.toTravelDestinationElement() }
)
}
suspend fun findAllBy(pageable: Pageable): Flux<TravelDestination>
suspend fun test(pageable: Pageable): List<TravelDestination> {
return travelDestinationRepository.findAllBy(pageable).collectList().awaitSingle()
}