spring-framework / org.springframework.messaging.handler.annotation.support / MethodArgumentNotValidException

MethodArgumentNotValidException

open class MethodArgumentNotValidException : 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.

Author
Brian Clozel

Author
Rossen Stoyanchev

Since
4.0.1

Constructors

<init>

MethodArgumentNotValidException(message: Message<*>, parameter: MethodParameter)

Create a new instance with the invalid MethodParameter.

MethodArgumentNotValidException(message: Message<*>, parameter: MethodParameter, bindingResult: BindingResult)

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

Functions

getBindingResult

fun getBindingResult(): BindingResult

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

Inherited Functions

getMethodParameter

fun getMethodParameter(): MethodParameter

Return the MethodParameter that was rejected.