Upgrade to Coroutines 1.3.0-RC

This commit upgrades Coroutines support to kotlinx.coroutines
1.3.0-RC, leverages the new Coroutines BOM and refine Coroutines
detection to avoid false positives.

Only Coroutines to Mono context interoperability is supported
for now.

CLoses gh-23326
This commit is contained in:
Sebastien Deleuze
2019-07-21 11:15:07 +02:00
parent 45136aabd4
commit c006a83584
9 changed files with 17 additions and 29 deletions

View File

@@ -17,7 +17,6 @@
package org.springframework.web.reactive.function.server
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.reactor.mono
import org.springframework.core.io.Resource
import org.springframework.http.HttpMethod
@@ -421,7 +420,7 @@ class CoRouterFunctionDsl(private val init: (CoRouterFunctionDsl.() -> Unit)) {
*/
fun resources(lookupFunction: suspend (ServerRequest) -> Resource?) {
builder.resources {
GlobalScope.mono(Dispatchers.Unconfined) {
mono(Dispatchers.Unconfined) {
lookupFunction.invoke(it)
}
}
@@ -436,7 +435,7 @@ class CoRouterFunctionDsl(private val init: (CoRouterFunctionDsl.() -> Unit)) {
}
private fun asHandlerFunction(init: suspend (ServerRequest) -> ServerResponse) = HandlerFunction {
GlobalScope.mono(Dispatchers.Unconfined) {
mono(Dispatchers.Unconfined) {
init(it)
}
}

View File

@@ -17,7 +17,6 @@
package org.springframework.web.reactive.server
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.reactor.mono
import org.springframework.http.codec.multipart.Part
@@ -69,4 +68,4 @@ suspend fun ServerWebExchange.awaitSession(): WebSession =
* @since 5.2
*/
fun ServerWebExchange.Builder.principal(supplier: suspend () -> Principal): ServerWebExchange.Builder
= principal(GlobalScope.mono(Dispatchers.Unconfined) { supplier.invoke() })
= principal(mono(Dispatchers.Unconfined) { supplier.invoke() })