【发布时间】:2018-07-30 15:19:19
【问题描述】:
我有扩展CrudRepository的存储库接口:
public interface ExampleRepository extends CrudRepository<Example, Long>{
List<Example> findByValidIsTrueLimit(Integer limit);
}
我想将结果列表限制为指定的限制,例如 SQL 查询中的 limit。
但是我得到:
引起:org.springframework.beans.factory.BeanCreationException: 创建名为“exampleRepository”的 bean 时出错:调用 init 方法失败;嵌套异常是 java.lang.IllegalArgumentException: 未能创建查询方法 public abstract 未找到属性限制 对于类型
如何将限制作为参数传递给CrudRepository 方法?
【问题讨论】:
标签: java spring spring-boot spring-data-jpa