org.springframework.web.servlet.config.annotation

## Class WebMvcConfigurerAdapter

- java.lang.Object
- - org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter

- All Implemented Interfaces:
    WebMvcConfigurer

  Deprecated.
  as of 5.0 `WebMvcConfigurer` has default methods (made possible by a Java 8 baseline) and can be implemented directly without the need for this adapter

      @Deprecated
      public abstract class WebMvcConfigurerAdapter
      extends Object
      implements WebMvcConfigurer

  An implementation of `WebMvcConfigurer` with empty methods allowing subclasses to override only the methods they're interested in.
  Since:
    3.1
  Author:
    Rossen Stoyanchev

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebMvcConfigurerAdapter()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)` Deprecated. Add resolvers to support custom controller method argument types.
    `void` | `addCorsMappings(CorsRegistry registry)` Deprecated. Configure "global" cross-origin request processing.
    `void` | `addFormatters(FormatterRegistry registry)` Deprecated. Add `Converters` and `Formatters` in addition to the ones registered by default.
    `void` | `addInterceptors(InterceptorRegistry registry)` Deprecated. Add Spring MVC lifecycle interceptors for pre- and post-processing of controller method invocations and resource handler requests.
    `void` | `addResourceHandlers(ResourceHandlerRegistry registry)` Deprecated. Add handlers to serve static resources such as images, js, and, css files from specific locations under web application root, the classpath, and others.
    `void` | `addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)` Deprecated. Add handlers to support custom controller method return value types.
    `void` | `addViewControllers(ViewControllerRegistry registry)` Deprecated. Configure simple automated controllers pre-configured with the response status code and/or a view to render the response body.
    `void` | `configureAsyncSupport(AsyncSupportConfigurer configurer)` Deprecated. Configure asynchronous request handling options.
    `void` | `configureContentNegotiation(ContentNegotiationConfigurer configurer)` Deprecated. Configure content negotiation options.
    `void` | `configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)` Deprecated. Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet.
    `void` | `configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)` Deprecated. Configure exception resolvers.
    `void` | `configureMessageConverters(List<HttpMessageConverter<?>> converters)` Deprecated. Configure the `HttpMessageConverter`s for reading from the request body and for writing to the response body.
    `void` | `configurePathMatch(PathMatchConfigurer configurer)` Deprecated. Help with configuring `HandlerMapping` path matching options such as whether to use parsed `PathPatterns` or String pattern matching with `PathMatcher`, whether to match trailing slashes, and more.
    `void` | `configureViewResolvers(ViewResolverRegistry registry)` Deprecated. Configure view resolvers to translate String-based view names returned from controllers into concrete `View` implementations to perform rendering with.
    `void` | `extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)` Deprecated. Extending or modify the list of exception resolvers configured by default.
    `void` | `extendMessageConverters(List<HttpMessageConverter<?>> converters)` Deprecated. Extend or modify the list of converters after it has been, either `configured` or initialized with a default list.
    `MessageCodesResolver` | `getMessageCodesResolver()` Deprecated. Provide a custom `MessageCodesResolver` for building message codes from data binding and validation error codes.
    `Validator` | `getValidator()` Deprecated. Provide a custom `Validator` instead of the one created by default.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WebMvcConfigurerAdapter

          public WebMvcConfigurerAdapter()

      Deprecated.

  - ### Method Detail

    - #### configurePathMatch

          public void configurePathMatch(PathMatchConfigurer configurer)

      Deprecated.
      Help with configuring `HandlerMapping` path matching options such as whether to use parsed `PathPatterns` or String pattern matching with `PathMatcher`, whether to match trailing slashes, and more.

      This implementation is empty.

      Specified by:
        `configurePathMatch` in interface `WebMvcConfigurer`
      See Also:
        `PathMatchConfigurer`

    - #### configureContentNegotiation

          public void configureContentNegotiation(ContentNegotiationConfigurer configurer)

      Deprecated.
      Configure content negotiation options.

      This implementation is empty.

      Specified by:
        `configureContentNegotiation` in interface `WebMvcConfigurer`

    - #### configureAsyncSupport

          public void configureAsyncSupport(AsyncSupportConfigurer configurer)

      Deprecated.
      Configure asynchronous request handling options.

      This implementation is empty.

      Specified by:
        `configureAsyncSupport` in interface `WebMvcConfigurer`

    - #### configureDefaultServletHandling

          public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer)

      Deprecated.
      Configure a handler to delegate unhandled requests by forwarding to the Servlet container's "default" servlet. A common use case for this is when the `DispatcherServlet` is mapped to "/" thus overriding the Servlet container's default handling of static resources.

      This implementation is empty.

      Specified by:
        `configureDefaultServletHandling` in interface `WebMvcConfigurer`

    - #### addFormatters

          public void addFormatters(FormatterRegistry registry)

      Deprecated.
      Add `Converters` and `Formatters` in addition to the ones registered by default.

      This implementation is empty.

      Specified by:
        `addFormatters` in interface `WebMvcConfigurer`

    - #### addInterceptors

          public void addInterceptors(InterceptorRegistry registry)

      Deprecated.
      Add Spring MVC lifecycle interceptors for pre- and post-processing of controller method invocations and resource handler requests. Interceptors can be registered to apply to all requests or be limited to a subset of URL patterns.

      This implementation is empty.

      Specified by:
        `addInterceptors` in interface `WebMvcConfigurer`

    - #### addResourceHandlers

          public void addResourceHandlers(ResourceHandlerRegistry registry)

      Deprecated.
      Add handlers to serve static resources such as images, js, and, css files from specific locations under web application root, the classpath, and others.

      This implementation is empty.

      Specified by:
        `addResourceHandlers` in interface `WebMvcConfigurer`
      See Also:
        `ResourceHandlerRegistry`

    - #### addCorsMappings

          public void addCorsMappings(CorsRegistry registry)

      Deprecated.
      Configure "global" cross-origin request processing. The configured CORS mappings apply to annotated controllers, functional endpoints, and static resources.

      Annotated controllers can further declare more fine-grained config via `@CrossOrigin`. In such cases "global" CORS configuration declared here is `combined` with local CORS configuration defined on a controller method.

      This implementation is empty.

      Specified by:
        `addCorsMappings` in interface `WebMvcConfigurer`
      See Also:
        `CorsRegistry`, `CorsConfiguration.combine(CorsConfiguration)`

    - #### addViewControllers

          public void addViewControllers(ViewControllerRegistry registry)

      Deprecated.
      Configure simple automated controllers pre-configured with the response status code and/or a view to render the response body. This is useful in cases where there is no need for custom controller logic -- e.g. render a home page, perform simple site URL redirects, return a 404 status with HTML content, a 204 with no content, and more.

      This implementation is empty.

      Specified by:
        `addViewControllers` in interface `WebMvcConfigurer`
      See Also:
        `ViewControllerRegistry`

    - #### configureViewResolvers

          public void configureViewResolvers(ViewResolverRegistry registry)

      Deprecated.
      Configure view resolvers to translate String-based view names returned from controllers into concrete `View` implementations to perform rendering with.

      This implementation is empty.

      Specified by:
        `configureViewResolvers` in interface `WebMvcConfigurer`

    - #### addArgumentResolvers

          public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers)

      Deprecated.
      Add resolvers to support custom controller method argument types.

      This does not override the built-in support for resolving handler method arguments. To customize the built-in support for argument resolution, configure `RequestMappingHandlerAdapter` directly.

      This implementation is empty.

      Specified by:
        `addArgumentResolvers` in interface `WebMvcConfigurer`
      Parameters:
        `argumentResolvers` - initially an empty list

    - #### addReturnValueHandlers

          public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers)

      Deprecated.
      Add handlers to support custom controller method return value types.

      Using this option does not override the built-in support for handling return values. To customize the built-in support for handling return values, configure RequestMappingHandlerAdapter directly.

      This implementation is empty.

      Specified by:
        `addReturnValueHandlers` in interface `WebMvcConfigurer`
      Parameters:
        `returnValueHandlers` - initially an empty list

    - #### configureMessageConverters

          public void configureMessageConverters(List<HttpMessageConverter<?>> converters)

      Deprecated.
      Configure the `HttpMessageConverter`s for reading from the request body and for writing to the response body.

      By default, all built-in converters are configured as long as the corresponding 3rd party libraries such Jackson JSON, JAXB2, and others are present on the classpath.

      Note use of this method turns off default converter registration. Alternatively, use `WebMvcConfigurer.extendMessageConverters(java.util.List)` to modify that default list of converters.

      This implementation is empty.

      Specified by:
        `configureMessageConverters` in interface `WebMvcConfigurer`
      Parameters:
        `converters` - initially an empty list of converters

    - #### extendMessageConverters

          public void extendMessageConverters(List<HttpMessageConverter<?>> converters)

      Deprecated.
      Extend or modify the list of converters after it has been, either `configured` or initialized with a default list.

      Note that the order of converter registration is important. Especially in cases where clients accept `MediaType.ALL` the converters configured earlier will be preferred.

      This implementation is empty.

      Specified by:
        `extendMessageConverters` in interface `WebMvcConfigurer`
      Parameters:
        `converters` - the list of configured converters to be extended

    - #### configureHandlerExceptionResolvers

          public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)

      Deprecated.
      Configure exception resolvers.

      The given list starts out empty. If it is left empty, the framework configures a default set of resolvers, see `WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(List, org.springframework.web.accept.ContentNegotiationManager)`. Or if any exception resolvers are added to the list, then the application effectively takes over and must provide, fully initialized, exception resolvers.

      Alternatively you can use `WebMvcConfigurer.extendHandlerExceptionResolvers(List)` which allows you to extend or modify the list of exception resolvers configured by default.

      This implementation is empty.

      Specified by:
        `configureHandlerExceptionResolvers` in interface `WebMvcConfigurer`
      Parameters:
        `exceptionResolvers` - initially an empty list
      See Also:
        `WebMvcConfigurer.extendHandlerExceptionResolvers(List)`, `WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(List, org.springframework.web.accept.ContentNegotiationManager)`

    - #### extendHandlerExceptionResolvers

          public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers)

      Deprecated.
      Extending or modify the list of exception resolvers configured by default. This can be useful for inserting a custom exception resolver without interfering with default ones.

      This implementation is empty.

      Specified by:
        `extendHandlerExceptionResolvers` in interface `WebMvcConfigurer`
      Parameters:
        `exceptionResolvers` - the list of configured resolvers to extend
      See Also:
        `WebMvcConfigurationSupport.addDefaultHandlerExceptionResolvers(List, org.springframework.web.accept.ContentNegotiationManager)`

    - #### getValidator

          @Nullable
          public Validator getValidator()

      Deprecated.
      Provide a custom `Validator` instead of the one created by default. The default implementation, assuming JSR-303 is on the classpath, is: `OptionalValidatorFactoryBean`. Leave the return value as `null` to keep the default.

      This implementation returns `null`.

      Specified by:
        `getValidator` in interface `WebMvcConfigurer`

    - #### getMessageCodesResolver

          @Nullable
          public MessageCodesResolver getMessageCodesResolver()

      Deprecated.
      Provide a custom `MessageCodesResolver` for building message codes from data binding and validation error codes. Leave the return value as `null` to keep the default.

      This implementation returns `null`.

      Specified by:
        `getMessageCodesResolver` in interface `WebMvcConfigurer`