org.springframework.messaging.handler.annotation.support

## Class MethodArgumentNotValidException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.springframework.core.NestedRuntimeException
        - - org.springframework.messaging.MessagingException
          - - org.springframework.messaging.handler.invocation.MethodArgumentResolutionException
            - - org.springframework.messaging.handler.annotation.support.MethodArgumentNotValidException

All Implemented Interfaces:
  Serializable

    public class MethodArgumentNotValidException
    extends MethodArgumentResolutionException

Exception to be thrown when a method argument fails validation perhaps as a result of `@Valid` style validation, or perhaps because it is required.

Since:
  4.0.1
Author:
  Brian Clozel, Rossen Stoyanchev
See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`MethodArgumentNotValidException(Message<?> message, org.springframework.core.MethodParameter parameter)` Create a new instance with the invalid `MethodParameter`.
`MethodArgumentNotValidException(Message<?> message, org.springframework.core.MethodParameter parameter, org.springframework.validation.BindingResult bindingResult)` Create a new instance with the invalid `MethodParameter` and a `BindingResult`.

### Method Summary

All Methods Instance Methods Concrete Methods
`org.springframework.validation.BindingResult` `getBindingResult()` Return the BindingResult if the failure is validation-related, or `null` if none.

### Methods inherited from class org.springframework.messaging.handler.invocation.MethodArgumentResolutionException

`getMethodParameter`

### Methods inherited from class org.springframework.messaging.MessagingException

`getFailedMessage, toString`

### Methods inherited from class org.springframework.core.NestedRuntimeException

`contains, getMessage, getMostSpecificCause, getRootCause`

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### MethodArgumentNotValidException

    public MethodArgumentNotValidException(Message<?> message,
                                           org.springframework.core.MethodParameter parameter)

Create a new instance with the invalid `MethodParameter`.

#### MethodArgumentNotValidException

    public MethodArgumentNotValidException(Message<?> message,
                                           org.springframework.core.MethodParameter parameter,
                                           org.springframework.validation.BindingResult bindingResult)

Create a new instance with the invalid `MethodParameter` and a `BindingResult`.

### Method Detail

#### getBindingResult

    @Nullable
    public final org.springframework.validation.BindingResult getBindingResult()

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