Skip to content

Commit 440bf94

Browse files
committed
Improve URLs in Validation chapter of the reference manual
In order to improve the user experience with URLs for sections of the Validation chapter, this commit makes the following changes to page names in the "validation" folder. - beans-beans.html --> data-binding.html - conversion.html --> error-code-resolution.html Some of the section anchors in data-binding.html have also been renamed. For example, #beans-beans is now #data-binding-property-binding. Closes gh-35181
1 parent cc59acb commit 440bf94

File tree

7 files changed

+30
-41
lines changed

7 files changed

+30
-41
lines changed

framework-docs/modules/ROOT/nav.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
** xref:core/resources.adoc[]
4141
** xref:core/validation.adoc[]
4242
*** xref:core/validation/validator.adoc[]
43-
*** xref:core/validation/beans-beans.adoc[]
44-
*** xref:core/validation/conversion.adoc[]
43+
*** xref:core/validation/data-binding.adoc[]
44+
*** xref:core/validation/error-code-resolution.adoc[]
4545
*** xref:core/validation/convert.adoc[]
4646
*** xref:core/validation/format.adoc[]
4747
*** xref:core/validation/format-configuring-formatting-globaldatetimeformat.adoc[]

framework-docs/modules/ROOT/pages/core/validation/beans-beans.adoc renamed to framework-docs/modules/ROOT/pages/core/validation/data-binding.adoc

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
[[beans-binding]]
1+
[[data-binding]]
22
= Data Binding
33

44
Data binding is useful for binding user input to a target object where user input is a map
5-
with property paths as keys, following xref:beans-beans-conventions[JavaBeans conventions].
5+
with property paths as keys, following xref:data-binding-conventions[JavaBeans conventions].
66
`DataBinder` is the main class that supports this, and it provides two ways to bind user
77
input:
88

9-
- xref:beans-constructor-binding[Constructor binding] - bind user input to a public data
10-
constructor, looking up constructor argument values in the user input.
11-
- xref:beans-beans[Property binding] - bind user input to setters, matching keys from the
12-
user input to properties of the target object structure.
9+
- xref:data-binding-constructor-binding[Constructor binding] - bind user input to a
10+
public data constructor, looking up constructor argument values in the user input.
11+
- xref:data-binding-property-binding[Property binding] - bind user input to setters,
12+
matching keys from the user input to properties of the target object structure.
1313

1414
You can apply both constructor and property binding or only one.
1515

1616

17-
[[beans-constructor-binding]]
17+
[[data-binding-constructor-binding]]
1818
== Constructor Binding
1919

2020
To use constructor binding:
@@ -32,7 +32,7 @@ WebFlux support a custom name mapping through the `@BindParam` annotation on con
3232
parameters or fields if present. If necessary, you can also configure a `NameResolver` on
3333
`DataBinder` to customize the argument name to use.
3434

35-
xref:beans-beans-conventions[Type conversion] is applied as needed to convert user input.
35+
xref:data-binding-conventions[Type conversion] is applied as needed to convert user input.
3636
If the constructor parameter is an object, it is constructed recursively in the same
3737
manner, but through a nested property path. That means constructor binding creates both
3838
the target object and any objects it contains.
@@ -46,9 +46,7 @@ If the target is created successfully, then `target` is set to the created insta
4646
after the call to `construct`.
4747

4848

49-
50-
51-
[[beans-beans]]
49+
[[data-binding-property-binding]]
5250
== Property Binding with `BeanWrapper`
5351

5452
The `org.springframework.beans` package adheres to the JavaBeans standard.
@@ -74,15 +72,14 @@ The way the `BeanWrapper` works is partly indicated by its name: it wraps a bean
7472
perform actions on that bean, such as setting and retrieving properties.
7573

7674

77-
78-
[[beans-beans-conventions]]
75+
[[data-binding-conventions]]
7976
=== Setting and Getting Basic and Nested Properties
8077

8178
Setting and getting properties is done through the `setPropertyValue` and
8279
`getPropertyValue` overloaded method variants of `BeanWrapper`. See their Javadoc for
8380
details. The below table shows some examples of these conventions:
8481

85-
[[beans-beans-conventions-properties-tbl]]
82+
[[data-binding-conventions-properties-tbl]]
8683
.Examples of properties
8784
|===
8885
| Expression| Explanation
@@ -106,7 +103,7 @@ details. The below table shows some examples of these conventions:
106103
(This next section is not vitally important to you if you do not plan to work with
107104
the `BeanWrapper` directly. If you use only the `DataBinder` and the `BeanFactory`
108105
and their default implementations, you should skip ahead to the
109-
xref:core/validation/beans-beans.adoc#beans-beans-conversion[section on `PropertyEditors`].)
106+
xref:core/validation/data-binding.adoc#data-binding-conversion[section on `PropertyEditors`].)
110107

111108
The following two example classes use the `BeanWrapper` to get and set
112109
properties:
@@ -239,9 +236,8 @@ Kotlin::
239236
======
240237

241238

242-
243-
[[beans-beans-conversion]]
244-
== ``PropertyEditor``'s
239+
[[data-binding-conversion]]
240+
== ``PropertyEditor``s
245241

246242
Spring uses the concept of a `PropertyEditor` to effect the conversion between an
247243
`Object` and a `String`. It can be handy
@@ -272,7 +268,7 @@ package. Most, (but not all, as indicated in the following table) are, by defaul
272268
still register your own variant to override the default one. The following table describes
273269
the various `PropertyEditor` implementations that Spring provides:
274270

275-
[[beans-beans-property-editors-tbl]]
271+
[[data-binding-property-editors-tbl]]
276272
.Built-in `PropertyEditor` Implementations
277273
[cols="30%,70%"]
278274
|===
@@ -426,8 +422,8 @@ Kotlin::
426422
======
427423

428424

429-
[[beans-beans-conversion-customeditor-registration]]
430-
=== Custom ``PropertyEditor``'s
425+
[[data-binding-conversion-customeditor-registration]]
426+
=== Custom ``PropertyEditor``s
431427

432428
When setting bean properties as string values, a Spring IoC container ultimately uses
433429
standard JavaBeans `PropertyEditor` implementations to convert these strings to the complex type of the
@@ -451,7 +447,7 @@ where it can be automatically detected and applied.
451447
Note that all bean factories and application contexts automatically use a number of
452448
built-in property editors, through their use of a `BeanWrapper` to
453449
handle property conversions. The standard property editors that the `BeanWrapper`
454-
registers are listed in the xref:core/validation/beans-beans.adoc#beans-beans-conversion[previous section].
450+
registers are listed in the xref:core/validation/data-binding.adoc#data-binding-conversion[previous section].
455451
Additionally, ``ApplicationContext``s also override or add additional editors to handle
456452
resource lookups in a manner appropriate to the specific application context type.
457453

@@ -569,7 +565,7 @@ Finally, the following example shows how to use `CustomEditorConfigurer` to regi
569565
</bean>
570566
----
571567

572-
[[beans-beans-conversion-customeditor-registration-per]]
568+
[[data-binding-conversion-customeditor-registration-per]]
573569
=== `PropertyEditorRegistrar`
574570

575571
Another mechanism for registering property editors with the Spring container is to
@@ -580,7 +576,7 @@ You can write a corresponding registrar and reuse it in each case.
580576
`PropertyEditorRegistry`, an interface that is implemented by the Spring `BeanWrapper`
581577
(and `DataBinder`). `PropertyEditorRegistrar` instances are particularly convenient
582578
when used in conjunction with `CustomEditorConfigurer` (described
583-
xref:core/validation/beans-beans.adoc#beans-beans-conversion-customeditor-registration[here]), which exposes a property
579+
xref:core/validation/data-binding.adoc#data-binding-conversion-customeditor-registration[here]), which exposes a property
584580
called `setPropertyEditorRegistrars(..)`. `PropertyEditorRegistrar` instances added
585581
to a `CustomEditorConfigurer` in this fashion can easily be shared with `DataBinder` and
586582
Spring MVC controllers. Furthermore, it avoids the need for synchronization on custom
@@ -703,7 +699,3 @@ This style of `PropertyEditor` registration can lead to concise code (the implem
703699
of the `@InitBinder` method is only one line long) and lets common `PropertyEditor`
704700
registration code be encapsulated in a class and then shared amongst as many controllers
705701
as needed.
706-
707-
708-
709-

framework-docs/modules/ROOT/pages/core/validation/conversion.adoc renamed to framework-docs/modules/ROOT/pages/core/validation/error-code-resolution.adoc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
[[validation-conversion]]
2-
= Resolving Codes to Error Messages
1+
[[validation-error-code-resolution]]
2+
= Resolving Error Codes to Error Messages
33

4-
We covered databinding and validation. This section covers outputting messages that correspond
4+
We covered data binding and validation. This section covers outputting messages that correspond
55
to validation errors. In the example shown in the xref:core/validation/validator.adoc[preceding section],
66
we rejected the `name` and `age` fields. If we want to output the error messages by using a
77
`MessageSource`, we can do so using the error code we provide when rejecting the field
@@ -23,6 +23,3 @@ in the javadoc of
2323
{spring-framework-api}/validation/DefaultMessageCodesResolver.html[`DefaultMessageCodesResolver`],
2424
respectively.
2525

26-
27-
28-

framework-docs/modules/ROOT/pages/core/validation/validator.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[validator]]
2-
= Validation by Using Spring's Validator Interface
2+
= Validation Using Spring's Validator Interface
33

44
Spring features a `Validator` interface that you can use to validate objects. The
55
`Validator` interface works by using an `Errors` object so that, while validating,

framework-docs/modules/ROOT/pages/web/webflux/controller/ann-methods/modelattrib-method-args.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ request parameters. Argument names are determined through runtime-retained param
4343
names in the bytecode.
4444

4545
By default, both constructor and property
46-
xref:core/validation/beans-beans.adoc#beans-binding[data binding] are applied. However,
46+
xref:core/validation/data-binding.adoc[data binding] are applied. However,
4747
model object design requires careful consideration, and for security reasons it is
4848
recommended either to use an object tailored specifically for web binding, or to apply
4949
constructor binding only. If property binding must still be used, then _allowedFields_

framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-methods/modelattrib-method-args.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Kotlin::
7878
======
7979

8080
By default, both constructor and property
81-
xref:core/validation/beans-beans.adoc#beans-binding[data binding] are applied. However,
81+
xref:core/validation/data-binding.adoc[data binding] are applied. However,
8282
model object design requires careful consideration, and for security reasons it is
8383
recommended either to use an object tailored specifically for web binding, or to apply
8484
constructor binding only. If property binding must still be used, then _allowedFields_

framework-docs/modules/ROOT/partials/web/web-data-binding-model-design.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
xref:core/validation/beans-beans.adoc#beans-binding[Data binding] for web requests involves
1+
xref:core/validation/data-binding.adoc[Data binding] for web requests involves
22
binding request parameters to a model object. By default, request parameters can be bound
33
to any public property of the model object, which means malicious clients can provide
44
extra values for properties that exist in the model object graph, but are not expected to
@@ -39,7 +39,7 @@ the properties required for the input:
3939
----
4040

4141
Another good practice is to apply
42-
xref:core/validation/beans-beans.adoc#beans-constructor-binding[constructor binding],
42+
xref:core/validation/data-binding.adoc#data-binding-constructor-binding[constructor binding],
4343
which uses only the request parameters it needs for constructor arguments, and any other
4444
input is ignored. This is in contrast to property binding which by default binds every
4545
request parameter for which there is a matching property.

0 commit comments

Comments
 (0)