mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Add ServerRequest.bindAndAwait Kotlin extension
Closes gh-36092
This commit is contained in:
+3
-3
@@ -17,13 +17,13 @@
|
||||
package org.springframework.docs.web.webfluxfnrequest
|
||||
|
||||
import org.springframework.web.reactive.function.server.ServerRequest
|
||||
import reactor.core.publisher.Mono
|
||||
import org.springframework.web.reactive.function.server.bindAndAwait
|
||||
|
||||
class RequestHandler {
|
||||
|
||||
fun bind(request: ServerRequest) {
|
||||
suspend fun bind(request: ServerRequest) {
|
||||
// tag::snippet[]
|
||||
val pet: Mono<Pet> = request.bind(Pet::class.java) { dataBinder -> dataBinder.setAllowedFields("name") }
|
||||
val pet: Pet? = request.bindAndAwait<Pet>{ dataBinder -> dataBinder.setAllowedFields("name") }
|
||||
// end::snippet[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user