我正在开发 reactive使用 Springboot WebFlux 的应用程序框架和 Couchbase DB。 Spring 为 Couchbase 提供了 JPA 实现,我的存储库界面如下所示。
@Repository
public interface ExampleRepository extends ReactiveCouchbaseRepository<Example, String> {
}
我通过这种方式在 Spring 配置(基于 Java)文件中启用响应式(Reactive) Couchbase 存储库
@Configuration
@EnableReactiveCouchbaseRepositories(basePackages = { "com.examples.repository" })
public class CouchDatabaseConfig extends AbstractCouchbaseConfiguration {
当我尝试通过调用存储库的 findById() 方法从数据库检索数据时,出现以下异常。
java.lang.IllegalArgumentException: Expected to find reactive adapter for class rx.Single but couldn't!
最佳答案
我花了很多时间来弄清楚为什么会出现这个异常,因为没有其他 Google 搜索结果可以帮助我解决这个问题。我在这里发布解决方案,希望对像我这样的人有帮助。
原因
Either you have not included the dependency for reactive streams or you have included an incompatible one.
将这一行添加到我的 build.gradle 中救了我的命。
compile('io.reactivex:rxjava-reactive-streams')
关于java - 使用 ReactiveCouchbaseRepository 时出现 IllegalArgumentException 期望找到类 rxSingle 的响应式(Reactive)适配器,但无法找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49002750/