SpelEvaluationException: EL1007E
@Query("select u from User u where u.age = ?#{[0]}")
List<User> findUsersByAge(int age);
@Query("select u from User u where u.firstname = :#{#customer.firstname}")
List<User> findUsersByCustomersFirstname(@Param("customer") Customer customer);
公开参数以进行索引访问([0]
在第一种方法中)或通过使用声明的名称@Param
。实际的SpEL表达式绑定由?#
或触发:#
。我们支持这两种类型,以允许您与查询定义中可能出现的标准JPQL参数绑定保持一致。
https://spring.io/blog/2014/07/15/spel-support-in-spring-data-jpa-query-definitions