org.springframework.web.bind

## Class MethodArgumentNotValidException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.springframework.validation.BindException
      - - org.springframework.web.bind.MethodArgumentNotValidException

- All Implemented Interfaces:
    Serializable, BindingResult, Errors

      public class MethodArgumentNotValidException
      extends BindException

  Exception to be thrown when validation on an argument annotated with `@Valid` fails. Extends `BindException` as of 5.3.
  Since:
    3.1
  Author:
    Rossen Stoyanchev, Juergen Hoeller
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface org.springframework.validation.BindingResult

      `MODEL_KEY_PREFIX`

    - ### Fields inherited from interface org.springframework.validation.Errors

      `NESTED_PATH_SEPARATOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MethodArgumentNotValidException(MethodParameter parameter, BindingResult bindingResult)` Constructor for `MethodArgumentNotValidException`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getMessage()` Returns diagnostic information about the errors held in this object.
    `MethodParameter` | `getParameter()` Return the method parameter that failed validation.

    - ### 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`

- - ### Constructor Detail

    - #### MethodArgumentNotValidException

          public MethodArgumentNotValidException(MethodParameter parameter,
                                                 BindingResult bindingResult)

      Constructor for `MethodArgumentNotValidException`.
      Parameters:
        `parameter` - the parameter that failed validation
        `bindingResult` - the results of the validation

  - ### Method Detail

    - #### getParameter

          public final MethodParameter getParameter()

      Return the method parameter that failed validation.

    - #### getMessage

          public String getMessage()

      Description copied from class: `BindException`
      Returns diagnostic information about the errors held in this object.
      Overrides:
        `getMessage` in class `BindException`