public class CustomRequestParamMethodArgumentResolver
extends org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver
implements org.springframework.web.method.support.UriComponentsContributor
添加对body参数的解析
| Constructor and Description |
|---|
CustomRequestParamMethodArgumentResolver(boolean useDefaultResolution)
Create a new
CustomRequestParamMethodArgumentResolver instance. |
CustomRequestParamMethodArgumentResolver(org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory,
boolean useDefaultResolution)
Create a new
CustomRequestParamMethodArgumentResolver instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
contributeMethodArgument(org.springframework.core.MethodParameter parameter,
Object value,
org.springframework.web.util.UriComponentsBuilder builder,
Map<String,Object> uriVariables,
org.springframework.core.convert.ConversionService conversionService) |
protected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(org.springframework.core.MethodParameter parameter) |
protected String |
formatUriValue(org.springframework.core.convert.ConversionService cs,
org.springframework.core.convert.TypeDescriptor sourceType,
Object value) |
protected void |
handleMissingValue(String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.context.request.NativeWebRequest request) |
protected Object |
resolveName(String name,
org.springframework.core.MethodParameter parameter,
org.springframework.web.context.request.NativeWebRequest request) |
boolean |
supportsParameter(org.springframework.core.MethodParameter parameter)
Supports the following:
@RequestParam-annotated method arguments.
|
public CustomRequestParamMethodArgumentResolver(boolean useDefaultResolution)
CustomRequestParamMethodArgumentResolver instance.useDefaultResolution - in default resolution mode a method argument
that is a simple type, as defined in BeanUtils.isSimpleProperty(java.lang.Class<?>),
is treated as a request parameter even if it isn't annotated, the
request parameter name is derived from the method parameter name.public CustomRequestParamMethodArgumentResolver(@Nullable
org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory,
boolean useDefaultResolution)
CustomRequestParamMethodArgumentResolver instance.beanFactory - a bean factory used for resolving ${...} placeholder
and #{...} SpEL expressions in default values, or null if default
values are not expected to contain expressionsuseDefaultResolution - in default resolution mode a method argument
that is a simple type, as defined in BeanUtils.isSimpleProperty(java.lang.Class<?>),
is treated as a request parameter even if it isn't annotated, the
request parameter name is derived from the method parameter name.public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
Map params where the annotation does not specify a name.
See RequestParamMapMethodArgumentResolver instead for such params.
MultipartFile unless annotated with @RequestPart.
Part unless annotated with @RequestPart.
RequestParam.
supportsParameter in interface org.springframework.web.method.support.HandlerMethodArgumentResolversupportsParameter in interface org.springframework.web.method.support.UriComponentsContributorprotected org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter)
createNamedValueInfo in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver@Nullable protected Object resolveName(String name, org.springframework.core.MethodParameter parameter, org.springframework.web.context.request.NativeWebRequest request) throws Exception
resolveName in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolverExceptionprotected void handleMissingValue(String name, org.springframework.core.MethodParameter parameter, org.springframework.web.context.request.NativeWebRequest request) throws Exception
handleMissingValue in class org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolverExceptionpublic void contributeMethodArgument(org.springframework.core.MethodParameter parameter,
@Nullable
Object value,
org.springframework.web.util.UriComponentsBuilder builder,
Map<String,Object> uriVariables,
org.springframework.core.convert.ConversionService conversionService)
contributeMethodArgument in interface org.springframework.web.method.support.UriComponentsContributorCopyright © 2022 Pivotal Software, Inc.. All rights reserved.