SpringBoot 2.3.0 上的 SpringDataCouchbase @Query 无法像以前一样工作
SpringDataCouchbase @Query on SpringBoot 2.3.0 not working as before
我几天前迁移到 SpringBoot 2.3.0,以便能够使用 SpringDataCouchbase 4.0.0 及其与 ReactiveTemplate 的完全反应式方法。但是,之前(SpringBoot 2.2.6)运行良好的简单@Query 正在抛出错误。这是查询:
@Query("#{#n1ql.selectEntity} WHERE docType = '" + NotificationMq.DOC_TYPE + "'")
Flux<NotificationMq> myCustomMethod();
所有内容(配置和字段注释已根据文档更新)但看起来 @Query 注释似乎没有考虑覆盖字符串派生查询。当前错误是:
org.springframework.data.mapping.PropertyReferenceException: No property myCustomMethod found for type NotificationMq!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:94) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:382) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:358) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.lambda$from[=11=](PropertyPath.java:311) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[na:1.8.0_144]
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:293) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:276) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:82) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new[=11=](PartTree.java:251) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
我的存储库定义如常:
@Repository
public interface NotificationMqRepository extends ReactiveSortingRepository<NotificationMq, String>
关于可能出错的任何想法?或者如何确定 @Query 是否覆盖并生成查询?
在此先感谢您的帮助。
根据 Couchbase 论坛的回答:
@Query 注释在 4.0.0 版中不受支持,但希望在 4.0.1 版中支持。
我几天前迁移到 SpringBoot 2.3.0,以便能够使用 SpringDataCouchbase 4.0.0 及其与 ReactiveTemplate 的完全反应式方法。但是,之前(SpringBoot 2.2.6)运行良好的简单@Query 正在抛出错误。这是查询:
@Query("#{#n1ql.selectEntity} WHERE docType = '" + NotificationMq.DOC_TYPE + "'")
Flux<NotificationMq> myCustomMethod();
所有内容(配置和字段注释已根据文档更新)但看起来 @Query 注释似乎没有考虑覆盖字符串派生查询。当前错误是:
org.springframework.data.mapping.PropertyReferenceException: No property myCustomMethod found for type NotificationMq!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:94) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:382) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:358) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.lambda$from[=11=](PropertyPath.java:311) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[na:1.8.0_144]
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:293) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:276) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:82) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new[=11=](PartTree.java:251) ~[spring-data-commons-2.3.0.RELEASE.jar:2.3.0.RELEASE]
我的存储库定义如常:
@Repository
public interface NotificationMqRepository extends ReactiveSortingRepository<NotificationMq, String>
关于可能出错的任何想法?或者如何确定 @Query 是否覆盖并生成查询?
在此先感谢您的帮助。
根据 Couchbase 论坛的回答:
@Query 注释在 4.0.0 版中不受支持,但希望在 4.0.1 版中支持。