JpaRepository:Paging query needs to have a Pageable parameter! Offending method public abstract
在练习 Spring Data JPA 时,使用分页接口 Pageable 查询数据,接口实现后,运行报错:
Paging query needs to have a Pageable parameter! Offending method public abstract
实现代码摘要:
import org.springframework.data.domain.Page;
import java.awt.print.Pageable
...
@Service
public class AyUserServiceImpl implements AyUserService {
@Resource
private AyUserRepository ayUserRepository;
...
@Override
public Page<AyUser> findAll(Pageable pageable){
return ayUserRepository.findAll(pageable);
}
}
后来发现,Pageable 的包名不对,改成了
import org.springframework.data.domain.Pageable;
运行就正常了