Skip to content

Commit 977582f

Browse files
committed
Document data binding for functional endpoints
Closes spring-projectsgh-35367
1 parent 64721b3 commit 977582f

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

framework-docs/modules/ROOT/pages/web/webflux-functional.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,28 @@ allPartsEvents.windowUntil(PartEvent::isLast)
294294
----
295295
======
296296

297-
Note that the body contents of the `PartEvent` objects must be completely consumed, relayed, or released to avoid memory leaks.
297+
NOTE: The body contents of the `PartEvent` objects must be completely consumed, relayed, or released to avoid memory leaks.
298+
299+
The following shows how to bind request parameters, including an optional `DataBinder` customization:
300+
301+
[tabs]
302+
======
303+
Java::
304+
+
305+
[source,java]
306+
----
307+
Pet pet = request.bind(Pet.class, dataBinder -> dataBinder.setAllowedFields("name"));
308+
----
309+
310+
Kotlin::
311+
+
312+
[source,kotlin]
313+
----
314+
val pet = request.bind(Pet::class.java, {dataBinder -> dataBinder.setAllowedFields("name")})
315+
----
316+
======
317+
318+
298319

299320
[[webflux-fn-response]]
300321
=== ServerResponse

framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,26 @@ val map = request.params()
184184
----
185185
======
186186

187+
The following shows how to bind request parameters, including an optional `DataBinder` customization:
188+
189+
[tabs]
190+
======
191+
Java::
192+
+
193+
[source,java]
194+
----
195+
Pet pet = request.bind(Pet.class, dataBinder -> dataBinder.setAllowedFields("name"));
196+
----
197+
198+
Kotlin::
199+
+
200+
[source,kotlin]
201+
----
202+
val pet = request.bind(Pet::class.java, {dataBinder -> dataBinder.setAllowedFields("name")})
203+
----
204+
======
205+
206+
187207
[[webmvc-fn-response]]
188208
=== ServerResponse
189209

0 commit comments

Comments
 (0)