# Deprecated API

## Contents

- Terminally Deprecated
- Interfaces
- Classes
- Exceptions
- Fields
- Methods
- Constructors
- Enum Constants

Terminally Deprecated Elements
Element
Description
org.springframework.http.client.ClientHttpResponse.getRawStatusCode()
in favor of `ClientHttpResponse.getStatusCode()`, for removal in 7.0
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.setBufferRequestBody(boolean)
since 6.1 requests are never buffered, as if this property is `false`
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.setConnectTimeout(int)
as of 6.2.13 in favor of setting it on `the connection configuration` for the `connection manager`.
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.setConnectTimeout(Duration)
as of 6.2.13 in favor of setting it on `the connection configuration` for the `connection manager`.
org.springframework.http.client.OkHttp3ClientHttpRequestFactory
since 6.1, in favor of other `ClientHttpRequestFactory` implementations; scheduled for removal in 7.0
org.springframework.http.client.reactive.ClientHttpResponse.getRawStatusCode()
in favor of `ClientHttpResponse.getStatusCode()`, for removal in 7.0
org.springframework.http.client.reactive.ReactorNetty2ClientHttpConnector
as of 6.2.18 with no replacement
org.springframework.http.client.reactive.ReactorNetty2ResourceFactory
as of 6.2.18 with no replacement
org.springframework.http.client.ReactorClientHttpRequestFactory.setExchangeTimeout(long)
as of 6.2 and no longer set by default (previously 5 seconds) in favor of using Reactor Netty HttpClient timeout configuration.
org.springframework.http.client.ReactorClientHttpRequestFactory.setExchangeTimeout(Duration)
as of 6.2 and no longer set by default (previously 5 seconds) in favor of using Reactor Netty HttpClient timeout configuration.
org.springframework.http.client.ReactorNettyClientRequestFactory
in favor of the renamed `ReactorClientHttpRequestFactory`
org.springframework.http.client.SimpleClientHttpRequestFactory.setBufferRequestBody(boolean)
since 6.1 requests are never buffered, as if this property is `false`
org.springframework.http.client.SimpleClientHttpRequestFactory.setOutputStreaming(boolean)
as of 6.1 requests are always streamed, as if this property is `true`
org.springframework.http.HttpHeaders.writableHttpHeaders(HttpHeaders)
as of 6.2 in favor of `HttpHeaders(MultiValueMap)`.
org.springframework.http.MediaType.APPLICATION_GRAPHQL
as of 6.0.3, in favor of `MediaType.APPLICATION_GRAPHQL_RESPONSE`
org.springframework.http.MediaType.APPLICATION_GRAPHQL_VALUE
as of 6.0.3, in favor of `MediaType.APPLICATION_GRAPHQL_RESPONSE_VALUE`
org.springframework.http.MediaType.QUALITY_VALUE_COMPARATOR
as of 6.0, with no direct replacement
org.springframework.http.MediaType.sortByQualityValue(List<MediaType>)
as of 6.0, with no direct replacement
org.springframework.http.MediaType.sortBySpecificity(List<MediaType>)
as of 6.0, in favor of `MimeTypeUtils.sortBySpecificity(List)`
org.springframework.http.MediaType.sortBySpecificityAndQuality(List<MediaType>)
as of 6.0, in favor of `MimeTypeUtils.sortBySpecificity(List)`
org.springframework.http.MediaType.SPECIFICITY_COMPARATOR
as of 6.0, with no direct replacement
org.springframework.http.server.reactive.ReactorNetty2HttpHandlerAdapter
as of 6.2.18 with no replacement
org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode()
in favor of `ServerHttpResponse.getStatusCode()`, for removal in 7.0
org.springframework.http.server.reactive.UndertowHttpHandlerAdapter
as of 6.2.18 with no replacement
org.springframework.http.support.Netty5HeadersAdapter
org.springframework.web.bind.MissingServletRequestParameterException(String, String, boolean)
in favor of `MissingServletRequestParameterException(String, MethodParameter, boolean)`
org.springframework.web.client.ResponseErrorHandler.handleError(ClientHttpResponse)
in favor of `ResponseErrorHandler.handleError(URI, HttpMethod, ClientHttpResponse)`
org.springframework.web.filter.reactive.ServerHttpObservationFilter
since 6.1 in favor of `WebHttpHandlerBuilder`.
org.springframework.web.server.handler.ResponseStatusExceptionHandler.determineRawStatusCode(Throwable)
in favor of `ResponseStatusExceptionHandler.determineStatus(Throwable)`, for removal in 7.0
org.springframework.web.service.invoker.HttpClientAdapter
in favor of `ReactorHttpExchangeAdapter`
org.springframework.web.util.ContentCachingRequestWrapper(HttpServletRequest)
in favor of `ContentCachingRequestWrapper(HttpServletRequest, int)` in order to explicitly choose the cache limit
org.springframework.web.util.UriComponentsBuilder.fromHttpRequest(HttpRequest)
in favor of `ForwardedHeaderUtils.adaptFromForwardedHeaders(java.net.URI, org.springframework.http.HttpHeaders)`; to be removed in 7.0
org.springframework.web.util.UriComponentsBuilder.fromOriginHeader(String)
in favor of `UriComponentsBuilder.fromUriString(String)`; to be removed in 7.0

Deprecated Interfaces
Interface
Description
org.springframework.web.service.invoker.HttpClientAdapter
in favor of `ReactorHttpExchangeAdapter`

Deprecated Classes
Class
Description
org.springframework.http.client.OkHttp3ClientHttpRequestFactory
since 6.1, in favor of other `ClientHttpRequestFactory` implementations; scheduled for removal in 7.0
org.springframework.http.client.reactive.ReactorNetty2ClientHttpConnector
as of 6.2.18 with no replacement
org.springframework.http.client.reactive.ReactorNetty2ResourceFactory
as of 6.2.18 with no replacement
org.springframework.http.client.reactive.ReactorResourceFactory
since 6.1 due to a package change; use `ReactorResourceFactory` instead.
org.springframework.http.client.ReactorNettyClientRequestFactory
in favor of the renamed `ReactorClientHttpRequestFactory`
org.springframework.http.server.reactive.ReactorNetty2HttpHandlerAdapter
as of 6.2.18 with no replacement
org.springframework.http.server.reactive.UndertowHttpHandlerAdapter
as of 6.2.18 with no replacement
org.springframework.http.support.Netty5HeadersAdapter
org.springframework.web.accept.PathExtensionContentNegotiationStrategy
as of 5.2.4. See class-level note in `ContentNegotiationManagerFactoryBean` on the deprecation of path extension config options.
org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy
as of 5.2.4. See class-level note in `ContentNegotiationManagerFactoryBean` on the deprecation of path extension config options.
org.springframework.web.filter.reactive.ServerHttpObservationFilter
since 6.1 in favor of `WebHttpHandlerBuilder`.
org.springframework.web.util.CookieGenerator
as of 6.0 in favor of `ResponseCookie`

Deprecated Exceptions
Exceptions
Description
org.springframework.web.util.NestedServletException
as of 6.0, in favor of standard `ServletException` nesting

Deprecated Fields
Field
Description
org.springframework.http.MediaType.APPLICATION_GRAPHQL
as of 6.0.3, in favor of `MediaType.APPLICATION_GRAPHQL_RESPONSE`
org.springframework.http.MediaType.APPLICATION_GRAPHQL_VALUE
as of 6.0.3, in favor of `MediaType.APPLICATION_GRAPHQL_RESPONSE_VALUE`
org.springframework.http.MediaType.APPLICATION_JSON_UTF8
as of 5.2 in favor of `MediaType.APPLICATION_JSON` since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a `charset=UTF-8` parameter.
org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE
as of 5.2 in favor of `MediaType.APPLICATION_JSON_VALUE` since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a `charset=UTF-8` parameter.
org.springframework.http.MediaType.APPLICATION_PROBLEM_JSON_UTF8
as of 5.2 in favor of `MediaType.APPLICATION_PROBLEM_JSON` since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a `charset=UTF-8` parameter.
org.springframework.http.MediaType.APPLICATION_PROBLEM_JSON_UTF8_VALUE
as of 5.2 in favor of `MediaType.APPLICATION_PROBLEM_JSON_VALUE` since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a `charset=UTF-8` parameter.
org.springframework.http.MediaType.APPLICATION_STREAM_JSON
as of 5.3, see notice on `MediaType.APPLICATION_STREAM_JSON_VALUE`.
org.springframework.http.MediaType.APPLICATION_STREAM_JSON_VALUE
as of 5.3 since it originates from the W3C Activity Streams specification which has a more specific purpose and has been since replaced with a different mime type. Use `MediaType.APPLICATION_NDJSON` as a replacement or any other line-delimited JSON format (for example, JSON Lines, JSON Text Sequences).
org.springframework.http.MediaType.QUALITY_VALUE_COMPARATOR
as of 6.0, with no direct replacement
org.springframework.http.MediaType.SPECIFICITY_COMPARATOR
as of 6.0, with no direct replacement

Deprecated Methods
Method
Description
org.springframework.http.client.ClientHttpResponse.getRawStatusCode()
in favor of `ClientHttpResponse.getStatusCode()`, for removal in 7.0
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.setBufferRequestBody(boolean)
since 6.1 requests are never buffered, as if this property is `false`
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.setConnectTimeout(int)
as of 6.2.13 in favor of setting it on `the connection configuration` for the `connection manager`.
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.setConnectTimeout(Duration)
as of 6.2.13 in favor of setting it on `the connection configuration` for the `connection manager`.
org.springframework.http.client.reactive.ClientHttpResponse.getRawStatusCode()
in favor of `ClientHttpResponse.getStatusCode()`, for removal in 7.0
org.springframework.http.client.ReactorClientHttpRequestFactory.setExchangeTimeout(long)
as of 6.2 and no longer set by default (previously 5 seconds) in favor of using Reactor Netty HttpClient timeout configuration.
org.springframework.http.client.ReactorClientHttpRequestFactory.setExchangeTimeout(Duration)
as of 6.2 and no longer set by default (previously 5 seconds) in favor of using Reactor Netty HttpClient timeout configuration.
org.springframework.http.client.SimpleClientHttpRequestFactory.setBufferRequestBody(boolean)
since 6.1 requests are never buffered, as if this property is `false`
org.springframework.http.client.SimpleClientHttpRequestFactory.setOutputStreaming(boolean)
as of 6.1 requests are always streamed, as if this property is `true`
org.springframework.http.codec.CodecConfigurer.CustomCodecs.decoder(Decoder<?>)
as of 5.1.13, use `CodecConfigurer.CustomCodecs.register(Object)` or `CodecConfigurer.CustomCodecs.registerWithDefaultConfig(Object)` instead.
org.springframework.http.codec.CodecConfigurer.CustomCodecs.encoder(Encoder<?>)
as of 5.1.13, use `CodecConfigurer.CustomCodecs.register(Object)` or `CodecConfigurer.CustomCodecs.registerWithDefaultConfig(Object)` instead.
org.springframework.http.codec.CodecConfigurer.CustomCodecs.reader(HttpMessageReader<?>)
as of 5.1.13, use `CodecConfigurer.CustomCodecs.register(Object)` or `CodecConfigurer.CustomCodecs.registerWithDefaultConfig(Object)` instead.
org.springframework.http.codec.CodecConfigurer.CustomCodecs.withDefaultCodecConfig(Consumer<CodecConfigurer.DefaultCodecConfig>)
as of 5.1.13, use `CodecConfigurer.CustomCodecs.registerWithDefaultConfig(Object)` or `CodecConfigurer.CustomCodecs.registerWithDefaultConfig(Object, Consumer)` instead.
org.springframework.http.codec.CodecConfigurer.CustomCodecs.writer(HttpMessageWriter<?>)
as of 5.1.13, use `CodecConfigurer.CustomCodecs.register(Object)` or `CodecConfigurer.CustomCodecs.registerWithDefaultConfig(Object)` instead.
org.springframework.http.ContentDisposition.Builder.creationDate(ZonedDateTime)
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.Builder.modificationDate(ZonedDateTime)
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.Builder.readDate(ZonedDateTime)
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.Builder.size(Long)
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.getCreationDate()
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.getModificationDate()
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.getReadDate()
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.ContentDisposition.getSize()
since 5.2.3 as per RFC 6266, Appendix B, to be removed in a future release.
org.springframework.http.HttpHeaders.writableHttpHeaders(HttpHeaders)
as of 6.2 in favor of `HttpHeaders(MultiValueMap)`.
org.springframework.http.HttpStatus.Series.valueOf(HttpStatus)
as of 5.3, in favor of invoking `HttpStatus.series()` directly
org.springframework.http.MediaType.sortByQualityValue(List<MediaType>)
as of 6.0, with no direct replacement
org.springframework.http.MediaType.sortBySpecificity(List<MediaType>)
as of 6.0, in favor of `MimeTypeUtils.sortBySpecificity(List)`
org.springframework.http.MediaType.sortBySpecificityAndQuality(List<MediaType>)
as of 6.0, in favor of `MimeTypeUtils.sortBySpecificity(List)`
org.springframework.http.ResponseEntity.getStatusCodeValue()
as of 6.0, in favor of `ResponseEntity.getStatusCode()`; scheduled for removal in 7.0
org.springframework.http.server.reactive.AbstractListenerWriteProcessor.writingPaused()
originally introduced for Undertow to stop write notifications when no data is available, but deprecated as of 5.0.6 since constant switching on every requested item causes a significant slowdown.
org.springframework.http.server.reactive.ServerHttpResponse.getRawStatusCode()
in favor of `ServerHttpResponse.getStatusCode()`, for removal in 7.0
org.springframework.http.server.reactive.ServerHttpResponseDecorator.getRawStatusCode()
org.springframework.web.accept.ContentNegotiationManagerFactoryBean.setFavorPathExtension(boolean)
as of 5.2.4. See class-level note on the deprecation of path extension config options.
org.springframework.web.accept.ContentNegotiationManagerFactoryBean.setIgnoreUnknownPathExtensions(boolean)
as of 5.2.4. See class-level note on the deprecation of path extension config options.
org.springframework.web.accept.ContentNegotiationManagerFactoryBean.setUseJaf(boolean)
as of 5.0, in favor of `ContentNegotiationManagerFactoryBean.setUseRegisteredExtensionsOnly(boolean)`, which has reverse behavior.
org.springframework.web.accept.PathExtensionContentNegotiationStrategy.setUseJaf(boolean)
as of 5.0, in favor of `AbstractMappingContentNegotiationStrategy.setUseRegisteredExtensionsOnly(boolean)`.
org.springframework.web.client.DefaultResponseErrorHandler.hasError(int)
in favor of `DefaultResponseErrorHandler.hasError(HttpStatusCode)`
org.springframework.web.client.ResponseErrorHandler.handleError(ClientHttpResponse)
in favor of `ResponseErrorHandler.handleError(URI, HttpMethod, ClientHttpResponse)`
org.springframework.web.client.RestClientResponseException.getRawStatusCode()
in favor of `RestClientResponseException.getStatusCode()`, for removal in 7.0
org.springframework.web.client.RestTemplate.doExecute(URI, HttpMethod, RequestCallback, ResponseExtractor<T>)
in favor of `RestTemplate.doExecute(URI, String, HttpMethod, RequestCallback, ResponseExtractor)`
org.springframework.web.client.UnknownContentTypeException.getRawStatusCode()
in favor of `UnknownContentTypeException.getStatusCode()`, for removal in 7.0
org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.getTheme(String)
org.springframework.web.context.support.GenericWebApplicationContext.getTheme(String)
org.springframework.web.context.support.StaticWebApplicationContext.getTheme(String)
org.springframework.web.cors.reactive.CorsUtils.isSameOrigin(ServerHttpRequest)
as of 5.2, same-origin checks are performed directly by `CorsUtils.isCorsRequest(org.springframework.http.server.reactive.ServerHttpRequest)`
org.springframework.web.cors.UrlBasedCorsConfigurationSource.setAlwaysUseFullPath(boolean)
as of 5.3 in favor of using `UrlBasedCorsConfigurationSource.setUrlPathHelper(UrlPathHelper)`, if at all. For further details, please see `UrlBasedCorsConfigurationSource.setAllowInitLookupPath(boolean)`.
org.springframework.web.cors.UrlBasedCorsConfigurationSource.setLookupPathAttributeName(String)
as of 5.3 in favor of `UrlPathHelper.PATH_ATTRIBUTE`.
org.springframework.web.cors.UrlBasedCorsConfigurationSource.setRemoveSemicolonContent(boolean)
as of 5.3 in favor of using `UrlBasedCorsConfigurationSource.setUrlPathHelper(UrlPathHelper)`, if at all. For further details, please see `UrlBasedCorsConfigurationSource.setAllowInitLookupPath(boolean)`.
org.springframework.web.cors.UrlBasedCorsConfigurationSource.setUrlDecode(boolean)
as of 5.3 in favor of using `UrlBasedCorsConfigurationSource.setUrlPathHelper(UrlPathHelper)`, if at all. For further details, please see `UrlBasedCorsConfigurationSource.setAllowInitLookupPath(boolean)`.
org.springframework.web.method.support.ModelAndViewContainer.setIgnoreDefaultModelOnRedirect(boolean)
as of 6.0 without a replacement; once removed, the default model will always be ignored on redirect
org.springframework.web.server.handler.ResponseStatusExceptionHandler.determineRawStatusCode(Throwable)
in favor of `ResponseStatusExceptionHandler.determineStatus(Throwable)`, for removal in 7.0
org.springframework.web.server.MethodNotAllowedException.getResponseHeaders()
as of 6.0 in favor of `MethodNotAllowedException.getHeaders()`
org.springframework.web.server.NotAcceptableStatusException.getResponseHeaders()
as of 6.0 in favor of `NotAcceptableStatusException.getHeaders()`
org.springframework.web.server.ResponseStatusException.getResponseHeaders()
as of 6.0 in favor of `ResponseStatusException.getHeaders()`
org.springframework.web.server.UnsupportedMediaTypeStatusException.getResponseHeaders()
as of 6.0 in favor of `UnsupportedMediaTypeStatusException.getHeaders()`
org.springframework.web.util.pattern.PathPatternParser.isMatchOptionalTrailingSeparator()
as of 6.0 together with `PathPatternParser.setMatchOptionalTrailingSeparator(boolean)`.
org.springframework.web.util.pattern.PathPatternParser.setMatchOptionalTrailingSeparator(boolean)
transparent support for trailing slashes is deprecated as of 6.0 in favor of configuring explicit redirects through a proxy, Servlet/web filter, or a controller.
org.springframework.web.util.UriComponentsBuilder.fromHttpRequest(HttpRequest)
in favor of `ForwardedHeaderUtils.adaptFromForwardedHeaders(java.net.URI, org.springframework.http.HttpHeaders)`; to be removed in 7.0
org.springframework.web.util.UriComponentsBuilder.fromHttpUrl(String)
as of 6.2, in favor of `UriComponentsBuilder.fromUriString(String)`; scheduled for removal in 7.0.
org.springframework.web.util.UriComponentsBuilder.fromOriginHeader(String)
in favor of `UriComponentsBuilder.fromUriString(String)`; to be removed in 7.0
org.springframework.web.util.UrlPathHelper.getLookupPathForRequest(HttpServletRequest, String)
as of 5.3 in favor of using `UrlPathHelper.resolveAndCacheLookupPath(HttpServletRequest)` and `UrlPathHelper.getResolvedLookupPath(ServletRequest)`.

Deprecated Constructors
Constructor
Description
org.springframework.http.client.reactive.JettyClientHttpConnector(JettyResourceFactory, Consumer<HttpClient>)
as of 5.2, in favor of `JettyClientHttpConnector(HttpClient, JettyResourceFactory)`
org.springframework.http.converter.HttpMessageNotReadableException(String)
as of 5.1, in favor of `HttpMessageNotReadableException(String, HttpInputMessage)`
org.springframework.http.converter.HttpMessageNotReadableException(String, Throwable)
as of 5.1, in favor of `HttpMessageNotReadableException(String, Throwable, HttpInputMessage)`
org.springframework.web.bind.MissingServletRequestParameterException(String, String, boolean)
in favor of `MissingServletRequestParameterException(String, MethodParameter, boolean)`
org.springframework.web.HttpMediaTypeException(String)
as of 6.0
org.springframework.web.HttpMediaTypeException(String, List<MediaType>)
as of 6.0
org.springframework.web.util.ContentCachingRequestWrapper(HttpServletRequest)
in favor of `ContentCachingRequestWrapper(HttpServletRequest, int)` in order to explicitly choose the cache limit

Deprecated Enum Constants
Enum Constant
Description
org.springframework.http.HttpStatus.CHECKPOINT
in favor of `HttpStatus.EARLY_HINTS` which will be returned from `HttpStatus.valueOf(103)`
org.springframework.http.HttpStatus.DESTINATION_LOCKED
See WebDAV Draft Changes
org.springframework.http.HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
See WebDAV Draft Changes
org.springframework.http.HttpStatus.METHOD_FAILURE
See WebDAV Draft Changes
org.springframework.http.HttpStatus.MOVED_TEMPORARILY
in favor of `HttpStatus.FOUND` which will be returned from `HttpStatus.valueOf(302)`
org.springframework.http.HttpStatus.REQUEST_ENTITY_TOO_LARGE
in favor of `HttpStatus.PAYLOAD_TOO_LARGE` which will be returned from `HttpStatus.valueOf(413)`
org.springframework.http.HttpStatus.REQUEST_URI_TOO_LONG
in favor of `HttpStatus.URI_TOO_LONG` which will be returned from `HttpStatus.valueOf(414)`
org.springframework.http.HttpStatus.USE_PROXY
due to security concerns regarding in-band configuration of a proxy