Exception to be thrown when validation on an argument annotated with
@Valid
fails.
Extends
BindException
as of 5.3.
Since:
Author:
Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze
See Also:
Serialized Form
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.web.
ErrorResponse
ErrorResponse.Builder
Field Summary
Fields inherited from interface org.springframework.validation.
BindingResult
MODEL_KEY_PREFIX
Fields inherited from interface org.springframework.validation.
Errors
NESTED_PATH_SEPARATOR
Convert each given
ObjectError
to a String in single quotes, taking
either the error's default message, or its error code.
Return the body for the response, formatted as an RFC 7807
ProblemDetail
whose
status
should match the response status.
Return arguments to use along with a
message code
to resolve the problem "detail" for this exception
through a
MessageSource
.
Returns diagnostic information about the errors held in this object.
Return the method parameter that failed validation.
Return the HTTP status code to use for the response.
Methods inherited from class org.springframework.validation.
BindException
addAllErrors
,
addError
,
equals
,
findEditor
,
getAllErrors
,
getBindingResult
,
getErrorCount
,
getFieldError
,
getFieldError
,
getFieldErrorCount
,
getFieldErrorCount
,
getFieldErrors
,
getFieldErrors
,
getFieldType
,
getFieldValue
,
getGlobalError
,
getGlobalErrorCount
,
getGlobalErrors
,
getModel
,
getNestedPath
,
getObjectName
,
getPropertyEditorRegistry
,
getRawFieldValue
,
getSuppressedFields
,
getTarget
,
hasErrors
,
hasFieldErrors
,
hasFieldErrors
,
hasGlobalErrors
,
hashCode
,
popNestedPath
,
pushNestedPath
,
recordFieldValue
,
recordSuppressedField
,
reject
,
reject
,
reject
,
rejectValue
,
rejectValue
,
rejectValue
,
resolveMessageCodes
,
resolveMessageCodes
,
setNestedPath
Methods inherited from class java.lang.
Throwable
addSuppressed
,
fillInStackTrace
,
getCause
,
getLocalizedMessage
,
getStackTrace
,
getSuppressed
,
initCause
,
printStackTrace
,
printStackTrace
,
printStackTrace
,
setStackTrace
,
toString
Methods inherited from class java.lang.
Object
clone
,
finalize
,
getClass
,
notify
,
notifyAll
,
wait
,
wait
,
wait
Methods inherited from interface org.springframework.web.
ErrorResponse
getDetailMessageCode
,
getHeaders
,
getTitleMessageCode
,
updateAndGetBody
MethodArgumentNotValidException
Parameters:
parameter
- the parameter that failed validation
bindingResult
- the results of the validation
MethodArgumentNotValidException
Parameters:
executable
- the executable that failed validation
bindingResult
- the results of the validation
Since:
6.0.5
getStatusCode
Return the HTTP status code to use for the response.
Specified by:
getStatusCode
in interface
ErrorResponse
getBody
Return the body for the response, formatted as an RFC 7807
ProblemDetail
whose
status
should match the response status.
Specified by:
getBody
in interface
ErrorResponse
Returns diagnostic information about the errors held in this object.
Overrides:
getMessage
in class
BindException
getDetailMessageArguments
public
Object
[]
getDetailMessageArguments
()
Return arguments to use along with a
message code
to resolve the problem "detail" for this exception
through a
MessageSource
. The arguments are expanded
into placeholders of the message value, e.g. "Invalid content type {0}".
Specified by:
getDetailMessageArguments
in interface
ErrorResponse
getDetailMessageArguments
Specified by:
getDetailMessageArguments
in interface
ErrorResponse
Parameters:
messageSource
- the
MessageSource
to use for the lookup
locale
- the
Locale
to use for the lookup
resolveErrorMessages
Returns:
a Map with errors as key and resolved messages as value
Since:
6.0.3
errorsToStringList
Convert each given
ObjectError
to a String in single quotes, taking
either the error's default message, or its error code.
Since:
errorsToStringList
Since: