我使用Spring Boot和WebFlux。
在我的代码中,我试图返回一个流量,但从intellij得到以下错误,代码被标记为红色:
no instance(s) of type variable(s) R exists so that Flux<UUID> conforms to Mono<>
public Flux<UUID> deleteCCProtections(Mono<ProtectionSetRequest> protectionSetRequest) {
return protectionSetRequest.flatMap(
request ->
protectionSetRepository
.findByProtectionSetIdIn(request.getProtectionSetIds())
.collectList()
.flatMap(
protectionSet -> //this line is marked red in Intellij
deleteCCProtectionset(protectionSet, request.getDeleteBackups()))); //this line is marked red in Intellij
}
private Flux<UUID> deleteCCProtectionset(
List<ProtectionSet> protectionSets, boolean deleteRecoveryPoints) {
return Flux.fromIterable(protectionSets)
.flatMap(
protectionSet ->
protectorRepository
.findByProtectionId(protectionSet.getProtectionId())
.flatMap(
protector ->
Mono.zip(
protectBatchService.delete(protector),
protectionSetRepository.delete(protectionSet))
.flatMap(
tuple ->
protectionService.sendUnprotectCommand(
tuple.getT1()))
.doOnNext(subscriptionResourceService::cancelSubscriptionResources)
//
// .doOnNext(agentDataServiceApi::setProtectedResources) //void
.doOnNext(schedulerService::deleteProtection))); //void
}
当我从参数deleteCCProtections中删除Mono时(Mono protectionSetRequest是我的代码编译的-为什么???我从控制器到服务将Mono...
工作代码,但没有单声道
public Flux<UUID> deleteCCProtections(ProtectionSetRequest protectionSetRequest) {
return protectionSetRepository
.findByProtectionSetIdIn(protectionSetRequest.getProtectionSetIds())
.collectList()
.flatMapMany(
protectionSet -> //this line is marked red in Intellij
deleteCCProtectionset(protectionSet, request.getDeleteBackups()))); //this line is marked red in Intellij
}
private Flux<UUID> deleteCCProtectionset(
List<ProtectionSet> protectionSets, boolean deleteRecoveryPoints) {
return Flux.fromIterable(protectionSets)
.flatMap(
protectionSet ->
protectorRepository
.findByProtectionId(protectionSet.getProtectionId())
.flatMap(
protector ->
Mono.zip(
protectBatchService.delete(protector),
protectionSetRepository.delete(protectionSet))
.flatMap(
tuple ->
protectionService.sendUnprotectCommand(
tuple.getT1()))
.doOnNext(subscriptionResourceService::cancelSubscriptionResources)
//
// .doOnNext(agentDataServiceApi::setProtectedResources) //void
.doOnNext(schedulerService::deleteProtection))); //void
}
由于deleteccprotectionset
返回flux
,因此在deleteccprotections
方法中应该使用flatmapmany
而不是flatmap
。
public Flux<UUID> deleteCCProtections(Mono<ProtectionSetRequest> protectionSetRequest) {
return protectionSetRequest.flatMapMany(request -> protectionSetRepository
.findByProtectionSetIdIn(request.getProtectionSetIds())
.collectList()
.flatMapMany(protectionSet -> deleteCCProtectionset(protectionSet, request.getDeleteBackups())));
}
我已经研究了几个小时,但似乎无法解决这个问题。错误与这段代码有关: (问题底部的完整代码。我用截图直观地显示问题。) 错误本身是: 不存在类型变量U的实例,因此GetUsersFaradacCountResponse符合CompletionStage 在s链的最开始,我删除了,并使用IntelliJ的“引入局部变量…”查看整个链(直至并包括第1118行)返回的类型的功能: 结果是一个 但是您可以看
我正在尝试开发一款android应用程序,具有回收视图。所以我创建了一个项目视图、一个模型类和适配器。在在viewHolder方法内部初始化,在初始化变量时显示错误,我无法找出下面这段代码的错误。 下面是item_view_model的代码。xml 下面是ModelClass的代码。JAVA 下面是**适配器的代码。爪哇** 如何解决这个问题??
我在下面看到一条红线,上面写着: “不存在类型变量V,K的实例,因此HashMultiMap符合MultiMap”。 有人能帮忙吗?我对下一步该做什么进退两难。
在以下代码中: 我在
我刚从一门课程中编写代码,这时出现了以下错误: