我是反应式编程的新手,我只是发现...,所以我的问题可能没有任何意义。我正在将Spring数据与反应式MongoDB结合使用,我只需要获取给定集合的所有文档的列表(以List(集合)而不是Flux)即可。
这是个人资料库:
@Repository
public interface PersonRepository extends ReactiveMongoRepository<Person, String> {
}
...这在人员服务中
List<Person> persons = repository.findAll()
.collectList()
.block();
问题是我从来没有从MongoDb获取数据,连接是打开也不是关闭,我想这是由于block()
方法引起的吗?
Opened connection [connectionId{localValue:3, serverValue:257}] to localhost:27017
...而且它永远不会结束!
谢谢。