Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java IllegalArgumentException在使用ReactiveCouchbaseRepository时预期会找到rxSingle类的反应适配器,但无法找到_Java_Spring_Reactive Programming_Couchbase_Spring Webflux - Fatal编程技术网

Java IllegalArgumentException在使用ReactiveCouchbaseRepository时预期会找到rxSingle类的反应适配器,但无法找到

Java IllegalArgumentException在使用ReactiveCouchbaseRepository时预期会找到rxSingle类的反应适配器,但无法找到,java,spring,reactive-programming,couchbase,spring-webflux,Java,Spring,Reactive Programming,Couchbase,Spring Webflux,我正在开发一个使用框架和Couchbase DB的应用程序。 Spring为Couchbase提供了JPA实现,我的存储库界面如下所示 @Repository public interface ExampleRepository extends ReactiveCouchbaseRepository<Example, String> { } 当我试图通过调用存储库的findById()方法从数据库检索数据时,我得到以下异常 java.lang.IllegalArgumentExc

我正在开发一个使用框架和Couchbase DB的应用程序。 Spring为Couchbase提供了JPA实现,我的存储库界面如下所示

@Repository
public interface ExampleRepository extends ReactiveCouchbaseRepository<Example, String> {

}
当我试图通过调用存储库的findById()方法从数据库检索数据时,我得到以下异常

java.lang.IllegalArgumentException: Expected to find reactive adapter for class rx.Single but couldn't!

我花了很多时间来弄清楚为什么会出现这个例外,因为没有其他谷歌搜索结果帮我解决了这个问题。我在这里发布解决方案,希望它能对像我这样的人有所帮助

原因

您没有包含反应流的依赖项,或者包含了不兼容的依赖项。

把这一行添加到我的build.gradle救了我的命

compile('io.reactivex:rxjava-reactive-streams')
compile('io.reactivex:rxjava-reactive-streams')