我正在尝试运行位于
here
. 然而,我看到一个
Error:(38, 22) Kotlin: None of the following functions can be called with the arguments supplied:
public final fun and(p0: ((Subscriber<in Any!>!) -> Unit)!): Mono<Void!>! defined in reactor.core.publisher.Mono
public final fun and(p0: Publisher<*>!): Mono<Void!>! defined in reactor.core.publisher.Mono
在里面
ApiHandler.kt
中的类
buildResponse
功能:
internal class ApiHandler(val geoLocationService: GeoLocationService, val sunriseSunsetService: SunriseSunsetService,
val errorHandler: ErrorHandler) {
private companion object {
const val ADDRESS = "address"
}
internal fun getLocation(request: ServerRequest) =
request.pathVariable(ADDRESS).toMono()
.transform(this::buildResponse)
.transform(this::serverResponse)
.onErrorResume(errorHandler::throwableError)!!
internal fun postLocation(request: ServerRequest) =
request.extract<LocationRequest>()
.map(LocationRequest::address)
.transform(this::buildResponse)
.transform(this::serverResponse)
.onErrorResume(errorHandler::throwableError)!!
internal fun buildResponse(address: Mono<String>) =
address.transform(geoLocationService::fromAddress)
.and(this::sunriseSunset, ::LocationResponse)
internal fun sunriseSunset(geographicCoordinates: GeographicCoordinates) =
geographicCoordinates.toMono().transform(sunriseSunsetService::fromGeographicCoordinates)
internal fun serverResponse(locationResponseMono: Mono<LocationResponse>): Mono<ServerResponse> =
locationResponseMono.flatMap { ok() withBody it }
}
我猜想自编写此代码以来,Spring API已经发生了更改,但我不知道要更改什么
.and(...)
到