我创建了返回类型 Slice 的 findAll 函数,然后收到此错误:
The return type is incompatible with PagingAndSortingRepository<Book,Long>.findAll(Pageable)
这是我在存储库中的代码:
import org.springframework.data.domain.Slice;
@SuppressWarnings("unused")
@Repository
public interface BookRepository extends JpaRepository<Book, Long>, JpaSpecificationExecutor<Book> {
Slice<Book> findAll(Pageable pageable);
}
我在这里做错了什么?
来自M的回答。 Deinum 在评论中
该方法已在 JpaRepository 中可用,并返回一个页面,您>无法使用其他返回类型重新定义它,并且您实际上不需要它>因为它已经存在。
“列表findAll(可分页可分页);”我使用了这个语句,然后出现错误 - “ - 返回类型与 PagingAndSortingRepository