You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LocalValidatorFactoryBean implements both <code>javax.validation.Validator</code> and <code>org.springframework.validation.Validator</code>.
1295
+
<classname>LocalValidatorFactoryBean</classname> implements both <code>javax.validation.Validator</code> and <code>org.springframework.validation.Validator</code>.
1286
1296
You may inject a reference to one of these two interfaces into beans that need to invoke validation logic.
1287
1297
</para>
1288
1298
<para>
1289
1299
Inject a reference to <code>javax.validation.Validator</code> if you prefer to work with the JSR-303 API directly:
Inject a reference to <code>org.springframework.validation.Validator</code> if your bean requires the Spring Validation API:
1304
1311
</para>
@@ -1324,7 +1331,7 @@ public class MyService {
1324
1331
At runtime, a <code>ConstraintValidatorFactory</code> instantiates the referenced implementation when the constraint annotation is encountered in your domain model.
1325
1332
</para>
1326
1333
<para>
1327
-
By default, the <code>LocalValidatorFactoryBean</code> configures a <code>SpringConstraintValidatorFactory</code> that uses Spring to create ConstraintValidator instances.
1334
+
By default, the <classname>LocalValidatorFactoryBean</classname> configures a <code>SpringConstraintValidatorFactory</code> that uses Spring to create ConstraintValidator instances.
1328
1335
This allows your custom ConstraintValidators to benefit from dependency injection like any other Spring bean.
1329
1336
</para>
1330
1337
<para>
@@ -1355,9 +1362,9 @@ public class MyConstraintValidator implements ConstraintValidator {
public void processFoo(<emphasisrole="bold">@Valid</emphasis> Foo foo) { <lineannotation>/* ... */</lineannotation> }
1411
+
</programlisting>
1409
1412
<para>
1410
1413
Spring MVC will validate a @Valid object after binding so-long as an appropriate Validator has been configured.
1411
1414
</para>
@@ -1457,7 +1460,7 @@ public class MyController {
1457
1460
<para>
1458
1461
With JSR-303, the default <code>javax.validation.Validator</code> implementation is generic.
1459
1462
A single instance typically coordinates the validation of <emphasis>all</emphasis> application objects that declare validation constraints.
1460
-
To configure such a general purpose Validator for use by Spring MVC, simply inject a <code>LocalValidatorFactoryBean</code> reference into the <code>WebBindingInitializer</code>.
1463
+
To configure such a general purpose Validator for use by Spring MVC, simply inject a <classname>LocalValidatorFactoryBean</classname> reference into the <code>WebBindingInitializer</code>.
1461
1464
</para>
1462
1465
<para>
1463
1466
A full configuration example showing injection of a JSR-303 backed Validator into Spring MVC is shown below:
@@ -1479,10 +1482,10 @@ public class MyController {
1479
1482
<para>
1480
1483
With this configuration, anytime a @Valid @Controller input is encountered, it will be validated by the JSR-303 provider.
1481
1484
JSR-303, in turn, will enforce any constraints declared against the input.
1482
-
Any ConstaintViolations will automatically be exposed as BindingResults renderable by standard Spring MVC form tags.
1485
+
Any ConstaintViolations will automatically be exposed as errors in the BindingResult renderable by standard Spring MVC form tags.
0 commit comments