我正在使用Spring Data MongodB 1.4.2.Release版本。對於Spring Data MongoDB,我在一個位置創建了自定義存儲庫接口和實現,並創建自定義查詢函數getUsersName(Users users)
。Spring Data MongoDB在org.springframework.data.mapping.PropertyPath沒有找到屬性類型
但是我仍然得到以下異常:
Caused by: org.springframework.data.mapping.PropertyReferenceException:
No property get found for type Users! at org.springframework.data.mapping.PropertyPath. (PropertyPath.java:75) at
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) at
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:359) at
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:359) at
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307) at
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270) at
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241) at
org.springframework.data.repository.query.parser.Part.(Part.java:76) at
org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:201) at
org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:291) at
org.springframework.data.repository.query.parser.PartTree$Predicate.(PartTree.java:271) at
org.springframework.data.repository.query.parser.PartTree.(PartTree.java:80) at
org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.(PartTreeMongoQuery.java:47)
下面是我的春節,數據MongoDB的結構:
如文檔中提到的自定義庫不起作用 - HTTP:/ /docs.spring.io/spring-data/data-mongo/docs/1.4.2.RELEASE/reference/html/repositories.html#repositories.custom-implementations – Navi
它的工作原理。看起來像實現類名稱不正確。 – Navi