SpringBoot jpa data Hibernate 分页查询错误

Error creating bean with name 'userController': 
Unsatisfied dependency expressed through field 'userRepository'; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'userRepository':
 Invocation of init method failed; 
nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! 
Offending method public abstract org.springframework.data.domain.Page com.czw.spring.boot.blog.repository.UserRepository.findByNameLike(java.lang.String,java.awt.print.Pageable)

Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Paging query needs to have a Pageable parameter! Offending method public abstract org.springframework.data.domain.Page com.czw.spring.boot.blog.repository.UserRepository.findByNameLike(java.lang.String,java.awt.print.Pageable)

原因是导错包了。

应该导入import org.springframework.data.domain.Pageable;

却错误导入了java.lang.String,java.awt.print.Pageable

程序员的日常分享,怕再一次错。

猜你喜欢

转载自blog.csdn.net/momo_mo520/article/details/88817619