# Deprecated API

## Contents

- Terminally Deprecated
- Interfaces
- Classes
- Fields
- Methods
- Constructors

Terminally Deprecated Elements
Element
Description
org.springframework.web.servlet.DispatcherServlet.setThrowExceptionIfNoHandlerFound(boolean)
as of 6.1 this property is set to `true` by default, and should not need to be customized; in effect, `DispatcherServlet` should always raise `NoHandlerFoundException` and allow it to be handled through a `HandlerExceptionResolver`.
org.springframework.web.servlet.function.ServerResponse.rawStatusCode()
in favor of `ServerResponse.statusCode()`, for removal in 7.0
org.springframework.web.servlet.handler.MappedInterceptor.getPathPatterns()
since 6.1 in favor of `MappedInterceptor.getIncludePathPatterns()`
org.springframework.web.servlet.resource.WebJarsResourceResolver
as of 6.2, in favor of `LiteWebJarsResourceResolver`

Deprecated Interfaces
Interface
Description
org.springframework.web.servlet.mvc.LastModified
as of 5.3.9 in favor of using the `checkNotModified` methods in `WebRequest`, or from an annotated controller method, returning a `ResponseEntity` with an "ETag" and/or "Last-Modified" headers set.
org.springframework.web.servlet.ThemeResolver
as of 6.0 in favor of using CSS, without direct replacement

Deprecated Classes
Class
Description
org.springframework.web.servlet.resource.WebJarsResourceResolver
as of 6.2, in favor of `LiteWebJarsResourceResolver`
org.springframework.web.servlet.tags.ThemeTag
as of 6.0, with no direct replacement
org.springframework.web.servlet.theme.AbstractThemeResolver
as of 6.0 in favor of using CSS, without direct replacement
org.springframework.web.servlet.theme.CookieThemeResolver
as of 6.0 in favor of using CSS, without direct replacement
org.springframework.web.servlet.theme.FixedThemeResolver
as of 6.0 in favor of using CSS, without direct replacement
org.springframework.web.servlet.theme.SessionThemeResolver
as of 6.0 in favor of using CSS, without direct replacement
org.springframework.web.servlet.theme.ThemeChangeInterceptor
as of 6.0 in favor of using CSS, without direct replacement
org.springframework.web.servlet.view.ResourceBundleViewResolver
as of 5.3, in favor of Spring's common view resolver variants and/or custom resolver implementations
org.springframework.web.servlet.view.XmlViewResolver
as of 5.3, in favor of Spring's common view resolver variants and/or custom resolver implementations

Deprecated Fields
Field
Description
org.springframework.web.servlet.DispatcherServlet.THEME_RESOLVER_ATTRIBUTE
as of 6.0, with no direct replacement
org.springframework.web.servlet.DispatcherServlet.THEME_RESOLVER_BEAN_NAME
as of 6.0, with no direct replacement
org.springframework.web.servlet.DispatcherServlet.THEME_SOURCE_ATTRIBUTE
as of 6.0, with no direct replacement
org.springframework.web.servlet.HandlerMapping.LOOKUP_PATH
as of 5.3 in favor of `UrlPathHelper.PATH_ATTRIBUTE` and `ServletRequestPathUtils.PATH_ATTRIBUTE`. To access the cached path used for request mapping, use `ServletRequestPathUtils.getCachedPathValue(ServletRequest)`.
org.springframework.web.servlet.support.RequestContext.DEFAULT_THEME_NAME
as of 6.0, with no direct replacement

Deprecated Methods
Method
Description
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer.favorPathExtension(boolean)
as of 5.2.4. See deprecation note on `ContentNegotiationManagerFactoryBean.setFavorPathExtension(boolean)`.
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer.ignoreUnknownPathExtensions(boolean)
as of 5.2.4. See deprecation note on `ContentNegotiationManagerFactoryBean.setIgnoreUnknownPathExtensions(boolean)`.
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer.useJaf(boolean)
as of 5.0, in favor of `ContentNegotiationConfigurer.useRegisteredExtensionsOnly(boolean)` which has reverse behavior
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.isUseRegisteredSuffixPatternMatch()
as of 5.2.4, see deprecation note on `PathMatchConfigurer.setUseRegisteredSuffixPatternMatch(Boolean)`.
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.isUseSuffixPatternMatch()
as of 5.2.4, see deprecation note on `PathMatchConfigurer.setUseSuffixPatternMatch(Boolean)`.
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.isUseTrailingSlashMatch()
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.setUseRegisteredSuffixPatternMatch(Boolean)
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.setUseSuffixPatternMatch(Boolean)
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.config.annotation.PathMatchConfigurer.setUseTrailingSlashMatch(Boolean)
as of 6.0, see `PathPatternParser.setMatchOptionalTrailingSeparator(boolean)`
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.themeResolver()
org.springframework.web.servlet.DispatcherServlet.getThemeSource()
org.springframework.web.servlet.DispatcherServlet.setThrowExceptionIfNoHandlerFound(boolean)
as of 6.1 this property is set to `true` by default, and should not need to be customized; in effect, `DispatcherServlet` should always raise `NoHandlerFoundException` and allow it to be handled through a `HandlerExceptionResolver`.
org.springframework.web.servlet.function.ServerRequest.methodName()
in favor of `ServerRequest.method()`
org.springframework.web.servlet.function.ServerRequest.pathContainer()
as of 5.3, in favor on `ServerRequest.requestPath()`
org.springframework.web.servlet.function.ServerResponse.rawStatusCode()
in favor of `ServerResponse.statusCode()`, for removal in 7.0
org.springframework.web.servlet.handler.AbstractHandlerMapping.setAlwaysUseFullPath(boolean)
as of 6.0, in favor of using `AbstractHandlerMapping.setUrlPathHelper(UrlPathHelper)`
org.springframework.web.servlet.handler.AbstractHandlerMapping.setRemoveSemicolonContent(boolean)
as of 6.0, in favor of using `AbstractHandlerMapping.setUrlPathHelper(UrlPathHelper)`
org.springframework.web.servlet.handler.AbstractHandlerMapping.setUrlDecode(boolean)
as of 6.0, in favor of using `AbstractHandlerMapping.setUrlPathHelper(UrlPathHelper)`
org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getMappingPathPatterns(T)
as of 5.3 in favor of providing non-pattern mappings via `AbstractHandlerMethodMapping.getDirectPaths(Object)` instead
org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.setUseTrailingSlashMatch(boolean)
as of 6.0, see `PathPatternParser.setMatchOptionalTrailingSeparator(boolean)`
org.springframework.web.servlet.handler.MappedInterceptor.getPathPatterns()
since 6.1 in favor of `MappedInterceptor.getIncludePathPatterns()`
org.springframework.web.servlet.handler.MappedInterceptor.matches(String, PathMatcher)
as of 5.3 in favor of `MappedInterceptor.matches(HttpServletRequest)`
org.springframework.web.servlet.HandlerAdapter.getLastModified(HttpServletRequest, Object)
as of 5.3.9 along with `LastModified`.
org.springframework.web.servlet.i18n.CookieLocaleResolver.determineDefaultLocale(HttpServletRequest)
as of 6.0, in favor of `CookieLocaleResolver.setDefaultLocaleFunction(Function)`
org.springframework.web.servlet.i18n.CookieLocaleResolver.determineDefaultTimeZone(HttpServletRequest)
as of 6.0, in favor of `CookieLocaleResolver.setDefaultTimeZoneFunction(Function)`
org.springframework.web.servlet.i18n.CookieLocaleResolver.setCookieMaxAge(Integer)
as of 6.0 in favor of `CookieLocaleResolver.setCookieMaxAge(Duration)`
org.springframework.web.servlet.i18n.CookieLocaleResolver.setCookieName(String)
as of 6.0 in favor of `CookieLocaleResolver(String)`
org.springframework.web.servlet.i18n.SessionLocaleResolver.determineDefaultLocale(HttpServletRequest)
as of 6.0, in favor of `SessionLocaleResolver.setDefaultLocaleFunction(Function)`
org.springframework.web.servlet.i18n.SessionLocaleResolver.determineDefaultTimeZone(HttpServletRequest)
as of 6.0, in favor of `SessionLocaleResolver.setDefaultTimeZoneFunction(Function)`
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.getLastModifiedInternal(HttpServletRequest, HandlerMethod)
as of 5.3.9 along with `LastModified`.
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.setIgnoreDefaultModelOnRedirect(boolean)
as of 6.0 without a replacement; once removed, the default model will always be ignored on redirect
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.getFileExtensions()
as of 5.2.4. See class-level note on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.setUseRegisteredSuffixPatternMatch(boolean)
as of 5.2.4. See class level note on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.setUseSuffixPatternMatch(boolean)
as of 5.2.4. See class-level note on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.setUseTrailingSlashMatch(boolean)
as of 6.0, see `PathPatternParser.setMatchOptionalTrailingSeparator(boolean)`
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.useRegisteredSuffixPatternMatch()
as of 5.2.4. See deprecation notice on `RequestMappingHandlerMapping.setUseRegisteredSuffixPatternMatch(boolean)`.
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.useSuffixPatternMatch()
as of 5.2.4. See deprecation notice on `RequestMappingHandlerMapping.setUseSuffixPatternMatch(boolean)`.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.getFileExtensions()
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.getUrlPathHelper()
as of 5.3, the path is resolved externally and obtained with `ServletRequestPathUtils.getCachedPathValue(ServletRequest)`; this method always returns `UrlPathHelper.defaultInstance`.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.setRegisteredSuffixPatternMatch(boolean)
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.setSuffixPatternMatch(boolean)
as of 5.2.4. See deprecation note on `RequestMappingHandlerMapping.setUseSuffixPatternMatch(boolean)`.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.setTrailingSlashMatch(boolean)
as of 6.0, see `PathPatternParser.setMatchOptionalTrailingSeparator(boolean)`
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.setUrlPathHelper(UrlPathHelper)
as of 5.3, the path is resolved externally and obtained with `ServletRequestPathUtils.getCachedPathValue(ServletRequest)`
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.useRegisteredSuffixPatternMatch()
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.useSuffixPatternMatch()
as of 5.2.4. See deprecation note on `RequestMappingHandlerMapping.setUseSuffixPatternMatch(boolean)`.
org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration.useTrailingSlashMatch()
as of 6.0 together with `RequestMappingInfo.BuilderConfiguration.setTrailingSlashMatch(boolean)`
org.springframework.web.servlet.mvc.WebContentInterceptor.setAlwaysUseFullPath(boolean)
as of 5.3, the path is resolved externally and obtained with `ServletRequestPathUtils.getCachedPathValue(ServletRequest)`
org.springframework.web.servlet.mvc.WebContentInterceptor.setUrlDecode(boolean)
as of 5.3, the path is resolved externally and obtained with `ServletRequestPathUtils.getCachedPathValue(ServletRequest)`
org.springframework.web.servlet.mvc.WebContentInterceptor.setUrlPathHelper(UrlPathHelper)
as of 5.3, the path is resolved externally and obtained with `ServletRequestPathUtils.getCachedPathValue(ServletRequest)`
org.springframework.web.servlet.resource.ResourceHttpRequestHandler.getContentNegotiationManager()
as of 5.2.4
org.springframework.web.servlet.resource.ResourceHttpRequestHandler.initContentNegotiationStrategy()
as of 5.2.4 this method returns `null`, and if a subclass returns an actual instance, the instance is used only as a source of media type mappings, if it contains any. Please, use `ResourceHttpRequestHandler.setMediaTypes(Map)` instead, or if you need to change behavior, you can override `ResourceHttpRequestHandler.getMediaType(HttpServletRequest, Resource)`.
org.springframework.web.servlet.resource.ResourceHttpRequestHandler.setContentNegotiationManager(ContentNegotiationManager)
as of 5.2.4 in favor of using `ResourceHttpRequestHandler.setMediaTypes(Map)` with mappings possibly obtained from `ContentNegotiationManager.getMediaTypeMappings()`.
org.springframework.web.servlet.support.RequestContext.changeTheme(String)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.changeTheme(Theme)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getFallbackTheme()
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getTheme()
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(String)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(String, Object[])
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(String, Object[], String)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(String, String)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(String, List<?>)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(String, List<?>, String)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContext.getThemeMessage(MessageSourceResolvable)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContextUtils.getTheme(HttpServletRequest)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContextUtils.getThemeResolver(HttpServletRequest)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.RequestContextUtils.getThemeSource(HttpServletRequest)
as of 6.0, with no direct replacement
org.springframework.web.servlet.support.WebContentGenerator.checkAndPrepare(HttpServletRequest, HttpServletResponse, int, boolean)
as of 4.2, since the `lastModified` flag is effectively ignored, with a must-revalidate header only generated if explicitly configured

Deprecated Constructors
Constructor
Description
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition(String[], UrlPathHelper, PathMatcher, boolean)
as of 5.3 in favor of `PatternsRequestCondition(String[], boolean, PathMatcher)`.
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition(String[], UrlPathHelper, PathMatcher, boolean, boolean)
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.condition.PatternsRequestCondition(String[], UrlPathHelper, PathMatcher, boolean, boolean, List<String>)
as of 5.2.4. See class-level note in `RequestMappingHandlerMapping` on the deprecation of path extension config options.
org.springframework.web.servlet.mvc.method.RequestMappingInfo(String, PatternsRequestCondition, RequestMethodsRequestCondition, ParamsRequestCondition, HeadersRequestCondition, ConsumesRequestCondition, ProducesRequestCondition, RequestCondition<?>)
as of 5.3 in favor using `RequestMappingInfo.Builder` via `RequestMappingInfo.paths(String...)`.
org.springframework.web.servlet.mvc.method.RequestMappingInfo(PatternsRequestCondition, RequestMethodsRequestCondition, ParamsRequestCondition, HeadersRequestCondition, ConsumesRequestCondition, ProducesRequestCondition, RequestCondition<?>)
as of 5.3 in favor using `RequestMappingInfo.Builder` via `RequestMappingInfo.paths(String...)`.
org.springframework.web.servlet.mvc.method.RequestMappingInfo(RequestMappingInfo, RequestCondition<?>)
since 5.3 in favor of using `RequestMappingInfo.addCustomCondition(RequestCondition)`.