RequestParamMethodArgumentResolver Resolves method arguments annotated with @RequestParam
, which extends AbstractNamedValueMethodArgumentResolver. AbstractNamedValueMethodArgumentResolver
creates a WebDataBinder
to apply type conversion to the resolved argument value if it doesn't match the method parameter type. Lets take a look at some part of resolveArguemnt
method:
try {
arg = binder.convertIfNecessary(arg, paramType, parameter);
}
catch (ConversionNotSupportedException ex) {
throw new MethodArgumentConversionNotSupportedException(arg, ex.getRequiredType(),
namedValueInfo.name, parameter, ex.getCause());
}
catch (TypeMismatchException ex) {
throw new MethodArgumentTypeMismatchException(arg, ex.getRequiredType(),
namedValueInfo.name, parameter, ex.getCause());
For RequestParam
, binder.convertIfNecessary
uses up to 116 different Converter
s to possibly convert from passed String
to required param, e.g. List
. Some of possible conversions are:
- String => Enum
- String => Properties
- String => Collection
I guess the only way to debug resolveArgument
method.