Skip to content

Commit cf1ba98

Browse files
committed
Documentation for Validator invocation via validateObject
See gh-19877
1 parent cb4222d commit cf1ba98

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ of Spring Web MVC, you can use the `<spring:bind/>` tag to inspect the error mes
195195
you can also inspect the `Errors` object yourself. More information about the
196196
methods it offers can be found in the {api-spring-framework}/validation/Errors.html[javadoc].
197197

198+
Validators may also get locally invoked for the immediate validation of a given object,
199+
not involving a binding process. As of 6.1, this has been simplified through a new
200+
`Validator.validateObject(Object)` method which is available by default now, returning
201+
a simple ´Errors` representation which can be inspected: typically calling `hasErrors()`
202+
or the new `failOnError` method for turning the error summary message into an exception
203+
(e.g. `validator.validateObject(myObject).failOnError(IllegalArgumentException::new)`).
198204

199205

200206

0 commit comments

Comments
 (0)