Page and @Page name importing collision
According to the documentation, for implementing Pagination and Sorting, with the result being a Page<T>, it should look like this:
@GetMapping("/cars")
Page<Car> search(@Filter Specification<Car> spec, @Page Pageable page) {
return repository.findAll(spec, page);
}
But, as far as I know, this is impossible, because Page<T> is org.springframework.data.domain.Page, and "@Page" is com.turkraft.springfilter.boot.Page.
Without the first one in the code, I loose the ability to return in my HTTP request the pagination information, and without the second one, the sort field throws an exception when using the "-" to indicate reverse direction.
So right now, for the code to function, it looks like this:
@GetMapping("/cars")
org.springframework.data.domain.Page<Car> search(@Filter Specification<Car> spec, @Page Pageable page) {
return repository.findAll(spec, page);
}
Or like this:
@GetMapping("/cars")
Page<Car> search(@Filter Specification<Car> spec, @com.turkraft.springfilter.boot.Page Pageable page) {
return repository.findAll(spec, page);
}
Is there something I'm doing wrong? I really want both the Page response, and the Page/Sorting functionality without the code looking tacky.
Thank you!