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
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:
-
Constructor Summary
ConstructorDescriptionMethodArgumentNotValidException
(Message<?> message, MethodParameter parameter) Create a new instance with the invalidMethodParameter
.MethodArgumentNotValidException
(Message<?> message, MethodParameter parameter, BindingResult bindingResult) Create a new instance with the invalidMethodParameter
and aBindingResult
. -
Method Summary
Modifier and TypeMethodDescriptionfinal BindingResult
Return the BindingResult if the failure is validation-related, ornull
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, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
MethodArgumentNotValidException
Create a new instance with the invalidMethodParameter
. -
MethodArgumentNotValidException
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult) Create a new instance with the invalidMethodParameter
and aBindingResult
.
-
-
Method Details
-
getBindingResult
Return the BindingResult if the failure is validation-related, ornull
if none.
-