private class StandaloneMockMvcBuilder.StandaloneConfiguration extends WebMvcConfigurationSupport
Modifier | Constructor and Description |
---|---|
private |
StandaloneConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected void |
addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
Add custom
HandlerMethodArgumentResolvers
to use in addition to the ones registered by default. |
protected void |
addInterceptors(InterceptorRegistry registry)
Override this method to add Spring MVC interceptors for
pre- and post-processing of controller invocation.
|
protected void |
addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
Add custom
HandlerMethodReturnValueHandlers
in addition to the ones registered by default. |
void |
configureAsyncSupport(AsyncSupportConfigurer configurer)
Override this method to configure asynchronous request processing options.
|
protected void |
configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
Override this method to configure the list of
HandlerExceptionResolvers to use. |
protected void |
configureMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
Override this method to add custom
HttpMessageConverters
to use with the RequestMappingHandlerAdapter and the
ExceptionHandlerExceptionResolver . |
RequestMappingHandlerMapping |
getHandlerMapping() |
ContentNegotiationManager |
mvcContentNegotiationManager()
Return a
ContentNegotiationManager instance to use to determine
requested media types in a given request. |
FormattingConversionService |
mvcConversionService()
Return a
FormattingConversionService for use with annotated controllers. |
Validator |
mvcValidator()
Return a global
Validator instance for example for validating
@ModelAttribute and @RequestBody method arguments. |
addCorsMappings, addDefaultHandlerExceptionResolvers, addDefaultHttpMessageConverters, addFormatters, addResourceHandlers, addViewControllers, beanNameHandlerMapping, configureContentNegotiation, configureDefaultServletHandling, configurePathMatch, configureViewResolvers, createExceptionHandlerExceptionResolver, createRequestMappingHandlerAdapter, createRequestMappingHandlerMapping, defaultServletHandlerMapping, extendHandlerExceptionResolvers, extendMessageConverters, getApplicationContext, getArgumentResolvers, getConfigurableWebBindingInitializer, getCorsConfigurations, getDefaultMediaTypes, getInterceptors, getMessageCodesResolver, getMessageConverters, getPathMatchConfigurer, getReturnValueHandlers, getServletContext, getValidator, handlerExceptionResolver, httpRequestHandlerAdapter, mvcHandlerMappingIntrospector, mvcPathMatcher, mvcResourceUrlProvider, mvcUriComponentsContributor, mvcUrlPathHelper, mvcViewResolver, requestMappingHandlerAdapter, requestMappingHandlerMapping, resourceHandlerMapping, setApplicationContext, setServletContext, simpleControllerHandlerAdapter, viewControllerHandlerMapping
public RequestMappingHandlerMapping getHandlerMapping()
protected void configureMessageConverters(java.util.List<HttpMessageConverter<?>> converters)
WebMvcConfigurationSupport
HttpMessageConverters
to use with the RequestMappingHandlerAdapter
and the
ExceptionHandlerExceptionResolver
.
Adding converters to the list turns off the default converters that would
otherwise be registered by default. Also see WebMvcConfigurationSupport.addDefaultHttpMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>>)
for adding default message converters.
configureMessageConverters
in class WebMvcConfigurationSupport
converters
- a list to add message converters to (initially an empty list)protected void addArgumentResolvers(java.util.List<HandlerMethodArgumentResolver> argumentResolvers)
WebMvcConfigurationSupport
HandlerMethodArgumentResolvers
to use in addition to the ones registered by default.
Custom argument resolvers are invoked before built-in resolvers except for
those that rely on the presence of annotations (e.g. @RequestParameter
,
@PathVariable
, etc). The latter can be customized by configuring the
RequestMappingHandlerAdapter
directly.
addArgumentResolvers
in class WebMvcConfigurationSupport
argumentResolvers
- the list of custom converters (initially an empty list)protected void addReturnValueHandlers(java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers)
WebMvcConfigurationSupport
HandlerMethodReturnValueHandlers
in addition to the ones registered by default.
Custom return value handlers are invoked before built-in ones except for
those that rely on the presence of annotations (e.g. @ResponseBody
,
@ModelAttribute
, etc). The latter can be customized by configuring the
RequestMappingHandlerAdapter
directly.
addReturnValueHandlers
in class WebMvcConfigurationSupport
returnValueHandlers
- the list of custom handlers (initially an empty list)protected void addInterceptors(InterceptorRegistry registry)
WebMvcConfigurationSupport
addInterceptors
in class WebMvcConfigurationSupport
InterceptorRegistry
public ContentNegotiationManager mvcContentNegotiationManager()
WebMvcConfigurationSupport
ContentNegotiationManager
instance to use to determine
requested media types in a given request.mvcContentNegotiationManager
in class WebMvcConfigurationSupport
public FormattingConversionService mvcConversionService()
WebMvcConfigurationSupport
FormattingConversionService
for use with annotated controllers.
See WebMvcConfigurationSupport.addFormatters(org.springframework.format.FormatterRegistry)
as an alternative to overriding this method.
mvcConversionService
in class WebMvcConfigurationSupport
public void configureAsyncSupport(AsyncSupportConfigurer configurer)
WebMvcConfigurationSupport
configureAsyncSupport
in class WebMvcConfigurationSupport
AsyncSupportConfigurer
public Validator mvcValidator()
WebMvcConfigurationSupport
Validator
instance for example for validating
@ModelAttribute
and @RequestBody
method arguments.
Delegates to WebMvcConfigurationSupport.getValidator()
first and if that returns null
checks the classpath for the presence of a JSR-303 implementations
before creating a OptionalValidatorFactoryBean
.If a JSR-303
implementation is not available, a no-op Validator
is returned.mvcValidator
in class WebMvcConfigurationSupport
protected void configureHandlerExceptionResolvers(java.util.List<HandlerExceptionResolver> exceptionResolvers)
WebMvcConfigurationSupport
HandlerExceptionResolvers
to use.
Adding resolvers to the list turns off the default resolvers that would otherwise
be registered by default. Also see WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(java.util.List<org.springframework.web.servlet.HandlerExceptionResolver>)
that can be used to add the default exception resolvers.
configureHandlerExceptionResolvers
in class WebMvcConfigurationSupport
exceptionResolvers
- a list to add exception resolvers to (initially an empty list)