Spring Data Jpa 异常:PropertyReferenceException: No property xx for type yy
来源:互联网 发布:c语言ascii码 编辑:程序博客网 时间:2024/05/17 15:35
今天在写完一个仓储层方法时,tomcat启动就抛出了一个异常,内容是:
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property xx found for type yy!
定义的接口和实现类大致为:
public interface OrderRepository extends JpaRepository<Order, Long>{Pager<Order> getList(int pageSize, int pageNo);}public class OrderRepositoryImpl{Pager<Order> getList(int pageSize, int pageNo){return ...;}}
想想平时也是这样,定义接口,然后定义约定的类,类名为接口名加上Impl后缀,这样调用方法时,Jpa可以自动调用实现类实现的方法。今天却不管用了。于是很纳闷,看起来没什么问题。这个异常,表名Jpa并没有找到我定义的类,而是把接口方法当成实体属性来判断了。为什么会找不到呢?仔细看,原来在实现类中的方法定义是从接口中拷出来的,方法使用缺省的访问权限修饰符(IDEA在定义接口中提示可以省略public)。于是想想是不是这个问题,加上修饰符public后,就不报错了。至于深层次的原因,还需要再看下,下回再做分享。
阅读全文
0 0
- Spring Data Jpa 异常:PropertyReferenceException: No property xx for type yy
- jpa中PropertyReferenceException: No property found for type异常原因
- Spring Data JPA 报错 :PropertyReferenceException: No property params found for type xxx!
- jpa PropertyReferenceException: No property user found for User异常
- Spring Data JPA: No property foo found for type Bar
- Spring Data JPA - “No Property Found for Type” Exception
- Spring Data JPA: No property name found for type ×××
- org.springframework.data.mapping.PropertyReferenceException: No property name found for type User
- Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for t
- Spring Data JPA 全局DAO的扩展(第一次用JPA时总是提示 另人抓狂的错误: No property find for type class )
- PropertyReferenceException: No property
- Spring Data jpa异常: Could not determine type for: java.util.List
- 解决Invalid derived query! No property find found for type XX的问题
- 解决Invalid derived query! No property find found for type XX的问题
- 解决Invalid derived query! No property find found for type XX的问题
- 解决Invalid derived query! No property find found for type XX的问题
- No data type for node
- org.springframework.data.mapping.model.MappingException: No id property found for object of type
- Socket网络通信安全
- 【面试题】锁
- C# 字符串字母的大小写组合
- lineNumber: 5; columnNumber: 451; cvc-elt.1: 找不到元素 'beans' 的声明。
- [leetcode] 21. Merge Two Sorted Lists
- Spring Data Jpa 异常:PropertyReferenceException: No property xx for type yy
- 测试连接失败,因为初始化提供程序时发生错误
- AngularJS的请求本地的json串并显示在表单上
- 实验四:用可重用的链表模块来实现命令行菜单小程序V2.5
- AngularJS Scope 表格
- Python基础详解
- OpenCV3_C++_Perspective()透视形式投影 实例
- codevs 1154 能量项链
- python 调用函数