Top Description Fields Constructors Methods
org.springframework.messaging.handler.annotation.support

public Class MethodArgumentNotValidException

extends MethodArgumentResolutionException
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
org.springframework.core.MethodParameter, org.springframework.lang.Nullable, org.springframework.messaging.Message, org.springframework.messaging.handler.invocation.MethodArgumentResolutionException, org.springframework.validation.BindingResult, .ObjectError

Exception to be thrown when a method argument fails validation perhaps as a result of @Valid style validation, or perhaps because it is required.
Authors
Brian Clozel, Rossen Stoyanchev
Since
4.0.1

Field Summary

Modifier and TypeField and Description
private final BindingResult

Constructor Summary

AccessConstructor and Description
public
MethodArgumentNotValidException(Message<?> message, MethodParameter parameter)

Create a new instance with the invalid MethodParameter.

public
MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult)

Create a new instance with the invalid MethodParameter and a org.springframework.validation.BindingResult.

Method Summary

Modifier and TypeMethod and Description
public final BindingResult
getBindingResult()

Return the BindingResult if the failure is validation-related, or null if none.

private static String
Inherited from org.springframework.messaging.handler.invocation.MethodArgumentResolutionException:
getMethodParameter

Field Detail

bindingResultback to summary
private final BindingResult bindingResult
Annotations
@Nullable

Constructor Detail

MethodArgumentNotValidExceptionback to summary
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter)

Create a new instance with the invalid MethodParameter.

MethodArgumentNotValidExceptionback to summary
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult)

Create a new instance with the invalid MethodParameter and a org.springframework.validation.BindingResult.

Method Detail

getBindingResultback to summary
public final BindingResult getBindingResult()

Return the BindingResult if the failure is validation-related, or null if none.

Annotations
@Nullable
getValidationErrorMessageback to summary
private static String getValidationErrorMessage(BindingResult bindingResult)