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
ConstructorsConstructorDescriptionMethodArgumentNotValidException(Message<?> message, MethodParameter parameter) Create a new instance with the invalidMethodParameter.MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult) Create a new instance with the invalidMethodParameterand aBindingResult. -
Method Summary
Modifier and TypeMethodDescriptionfinal @Nullable BindingResultReturn the BindingResult if the failure is validation-related, ornullif none.Methods inherited from class org.springframework.messaging.handler.invocation.MethodArgumentResolutionException
getMethodParameterMethods inherited from class org.springframework.messaging.MessagingException
getFailedMessage, toStringMethods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCauseMethods 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 invalidMethodParameterand aBindingResult.
-
-
Method Details
-
getBindingResult
Return the BindingResult if the failure is validation-related, ornullif none.
-