# Deprecated API

## Contents

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

Terminally Deprecated Elements
Element
Description
org.springframework.aot.hint.support.FilePatternResourceHintsRegistrar(List<String>, List<String>, List<String>)
as of 6.0.12 in favor of the builder
org.springframework.aot.hint.support.FilePatternResourceHintsRegistrar.registerHints(ResourceHints, ClassLoader)
org.springframework.core.BridgeMethodResolver.isVisibilityBridgeMethodPair(Method, Method)
as of 6.2.13: not necessary anymore due to `BridgeMethodResolver.getMostSpecificMethod(java.lang.reflect.Method, java.lang.Class<?>)`
org.springframework.core.codec.Netty5BufferDecoder
as of 6.2.18 with no replacement
org.springframework.core.codec.Netty5BufferEncoder
as of 6.2.18 with no replacement
org.springframework.core.io.buffer.Netty5DataBuffer
as of 6.2.18 with no replacement
org.springframework.core.io.buffer.Netty5DataBufferFactory
as of 6.2.18 with no replacement
org.springframework.core.task.AsyncListenableTaskExecutor
as of 6.0, in favor of `AsyncTaskExecutor.submitCompletable(Runnable)` and `AsyncTaskExecutor.submitCompletable(Callable)`
org.springframework.core.task.AsyncListenableTaskExecutor.submitListenable(Runnable)
in favor of `AsyncTaskExecutor.submitCompletable(Runnable)`
org.springframework.core.task.AsyncListenableTaskExecutor.submitListenable(Callable<T>)
in favor of `AsyncTaskExecutor.submitCompletable(Callable)`
org.springframework.util.concurrent.CompletableToListenableFutureAdapter
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.FailureCallback
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.ListenableFuture
as of 6.0, in favor of `CompletableFuture`
org.springframework.util.concurrent.ListenableFuture.addCallback(ListenableFutureCallback<? super T>)
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.ListenableFuture.addCallback(SuccessCallback<? super T>, FailureCallback)
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.ListenableFutureAdapter
as of 6.0, in favor of `CompletableFuture`
org.springframework.util.concurrent.ListenableFutureCallback
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.ListenableFutureCallbackRegistry
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.ListenableFutureTask
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.SettableListenableFuture
as of 6.0, in favor of `CompletableFuture`
org.springframework.util.concurrent.SuccessCallback
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.MimeType.SpecificityComparator
As of 6.0, with no direct replacement
org.springframework.util.MimeTypeUtils.SPECIFICITY_COMPARATOR
As of 6.0, with no direct replacement
org.springframework.util.PropertyPlaceholderHelper(String, String, String, boolean)
as of 6.2, in favor of `PropertyPlaceholderHelper(String, String, String, Character, boolean)`
org.springframework.util.PropertyPlaceholderHelper.parseStringValue(String, PropertyPlaceholderHelper.PlaceholderResolver)

Deprecated Interfaces
Interface
Description
org.springframework.core.task.AsyncListenableTaskExecutor
as of 6.0, in favor of `AsyncTaskExecutor.submitCompletable(Runnable)` and `AsyncTaskExecutor.submitCompletable(Callable)`
org.springframework.util.concurrent.FailureCallback
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.ListenableFuture
as of 6.0, in favor of `CompletableFuture`
org.springframework.util.concurrent.ListenableFutureCallback
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.SuccessCallback
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`

Deprecated Classes
Class
Description
org.springframework.cglib.core.TinyBitSet
org.springframework.core.codec.Netty5BufferDecoder
as of 6.2.18 with no replacement
org.springframework.core.codec.Netty5BufferEncoder
as of 6.2.18 with no replacement
org.springframework.core.Constants
since 6.1 with no replacement; use an enum, map, or similar custom solution instead
org.springframework.core.env.JOptCommandLinePropertySource
since 6.1 with no plans for a replacement
org.springframework.core.io.buffer.Netty5DataBuffer
as of 6.2.18 with no replacement
org.springframework.core.io.buffer.Netty5DataBufferFactory
as of 6.2.18 with no replacement
org.springframework.util.comparator.ComparableComparator
as of 6.1 in favor of `Comparator.naturalOrder()`
org.springframework.util.comparator.NullSafeComparator
as of 6.1 in favor of `Comparator.nullsLast(java.util.Comparator<? super T>)` and `Comparator.nullsFirst(java.util.Comparator<? super T>)`
org.springframework.util.concurrent.CompletableToListenableFutureAdapter
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.FutureAdapter
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.ListenableFutureAdapter
as of 6.0, in favor of `CompletableFuture`
org.springframework.util.concurrent.ListenableFutureCallbackRegistry
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.ListenableFutureTask
as of 6.0, with no concrete replacement
org.springframework.util.concurrent.MonoToListenableFutureAdapter
as of 6.0, in favor of `Mono.toFuture()`
org.springframework.util.concurrent.SettableListenableFuture
as of 6.0, in favor of `CompletableFuture`
org.springframework.util.MimeType.SpecificityComparator
As of 6.0, with no direct replacement

Deprecated Exceptions
Exceptions
Description
org.springframework.core.task.TaskTimeoutException
as of 5.3.16 since the common executors do not support start timeouts

Deprecated Fields
Field
Description
org.springframework.asm.ClassReader.b
Use `ClassReader.readByte(int)` and the other read methods instead. This field will eventually be deleted.
org.springframework.cglib.core.KeyFactory.OBJECT_BY_CLASS
this customizer might result in unexpected class leak since key object still holds a strong reference to the Object and class. It is recommended to have pre-processing method that would strip Objects and represent Classes as Strings
org.springframework.core.annotation.AnnotationFilter.NONE
as of 5.2.6 since the `MergedAnnotations` model always ignores lang annotations according to the `AnnotationFilter.PLAIN` filter (for efficiency reasons)
org.springframework.core.task.AsyncTaskExecutor.TIMEOUT_IMMEDIATE
as of 5.3.16 along with `AsyncTaskExecutor.execute(Runnable, long)`
org.springframework.core.task.AsyncTaskExecutor.TIMEOUT_INDEFINITE
as of 5.3.16 along with `AsyncTaskExecutor.execute(Runnable, long)`
org.springframework.util.MimeTypeUtils.SPECIFICITY_COMPARATOR
As of 6.0, with no direct replacement

Deprecated Methods
Method
Description
org.springframework.aot.hint.support.FilePatternResourceHintsRegistrar.registerHints(ResourceHints, ClassLoader)
org.springframework.asm.Attribute.getLabels()
no longer used by ASM.
org.springframework.asm.ClassWriter.newHandle(int, String, String, String)
this method is superseded by `ClassWriter.newHandle(int, String, String, String, boolean)`.
org.springframework.asm.MethodVisitor.visitMethodInsn(int, String, String, String)
use `MethodVisitor.visitMethodInsn(int, String, String, String, boolean)` instead.
org.springframework.cglib.core.CodeEmitter.invoke_static(Type, Signature)
org.springframework.cglib.core.EmitUtils.append_string(CodeEmitter, Type, EmitUtils.ArrayDelimiters, Customizer)
use `EmitUtils.append_string(CodeEmitter, Type, ArrayDelimiters, CustomizerRegistry)` instead
org.springframework.cglib.core.EmitUtils.hash_code(CodeEmitter, Type, int, Customizer)
use `EmitUtils.hash_code(CodeEmitter, Type, int, CustomizerRegistry)` instead
org.springframework.cglib.core.EmitUtils.not_equals(CodeEmitter, Type, Label, Customizer)
use `EmitUtils.not_equals(CodeEmitter, Type, Label, CustomizerRegistry)` instead
org.springframework.cglib.core.internal.CustomizerRegistry.singleton(Customizer)
Only to keep backward compatibility.
org.springframework.cglib.core.KeyFactory.Generator.setCustomizer(Customizer)
Use `KeyFactory.Generator.addCustomizer(KeyFactoryCustomizer)` instead.
org.springframework.core.annotation.AnnotationUtils.findAnnotationDeclaringClass(Class<? extends Annotation>, Class<?>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.findAnnotationDeclaringClassForTypes(List<Class<? extends Annotation>>, Class<?>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.getAnnotations(AnnotatedElement)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.getAnnotations(Method)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.getDeclaredRepeatableAnnotations(AnnotatedElement, Class<A>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.getDeclaredRepeatableAnnotations(AnnotatedElement, Class<A>, Class<? extends Annotation>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.getRepeatableAnnotations(AnnotatedElement, Class<A>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.getRepeatableAnnotations(AnnotatedElement, Class<A>, Class<? extends Annotation>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.isAnnotationInherited(Class<? extends Annotation>, Class<?>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.annotation.AnnotationUtils.isAnnotationMetaPresent(Class<? extends Annotation>, Class<? extends Annotation>)
as of 5.2 since it is superseded by the `MergedAnnotations` API
org.springframework.core.BridgeMethodResolver.isVisibilityBridgeMethodPair(Method, Method)
as of 6.2.13: not necessary anymore due to `BridgeMethodResolver.getMostSpecificMethod(java.lang.reflect.Method, java.lang.Class<?>)`
org.springframework.core.codec.AbstractDataBufferDecoder.decodeDataBuffer(DataBuffer, ResolvableType, MimeType, Map<String, Object>)
as of 5.2, please implement `Decoder.decode(DataBuffer, ResolvableType, MimeType, Map)` instead
org.springframework.core.env.AbstractEnvironment.acceptsProfiles(String...)
org.springframework.core.env.Environment.acceptsProfiles(String...)
as of 5.1 in favor of `Environment.acceptsProfiles(Profiles)` or `Environment.matchesProfiles(String...)`
org.springframework.core.GenericTypeResolver.resolveParameterType(MethodParameter, Class<?>)
since 5.2 in favor of `methodParameter.withContainingClass(implementationClass).getParameterType()`
org.springframework.core.io.buffer.DataBuffer.asByteBuffer()
as of 6.0, in favor of `DataBuffer.toByteBuffer(ByteBuffer)`, `DataBuffer.readableByteBuffers()` or `DataBuffer.writableByteBuffers()`
org.springframework.core.io.buffer.DataBuffer.asByteBuffer(int, int)
as of 6.0, in favor of `DataBuffer.toByteBuffer(int, ByteBuffer, int, int)`, `DataBuffer.readableByteBuffers()` or `DataBuffer.writableByteBuffers()`
org.springframework.core.io.buffer.DataBuffer.capacity(int)
as of 6.0, in favor of `DataBuffer.ensureWritable(int)` which has different semantics
org.springframework.core.io.buffer.DataBuffer.ensureCapacity(int)
since 6.0, in favor of `DataBuffer.ensureWritable(int)`
org.springframework.core.io.buffer.DataBuffer.retainedSlice(int, int)
as of 6.0, in favor of `DataBuffer.split(int)` which has different semantics
org.springframework.core.io.buffer.DataBuffer.slice(int, int)
as of 6.0, in favor of `DataBuffer.split(int)` which has different semantics
org.springframework.core.io.buffer.DataBuffer.toByteBuffer()
as of 6.0.5, in favor of `DataBuffer.toByteBuffer(ByteBuffer)`
org.springframework.core.io.buffer.DataBuffer.toByteBuffer(int, int)
as of 6.0.5, in favor of `DataBuffer.toByteBuffer(int, ByteBuffer, int, int)`
org.springframework.core.io.buffer.DataBufferFactory.allocateBuffer()
as of 6.0, in favor of `DataBufferFactory.allocateBuffer(int)`
org.springframework.core.io.buffer.DataBufferWrapper.asByteBuffer()
org.springframework.core.io.buffer.DataBufferWrapper.asByteBuffer(int, int)
org.springframework.core.io.buffer.DataBufferWrapper.capacity(int)
org.springframework.core.io.buffer.DataBufferWrapper.ensureCapacity(int)
org.springframework.core.io.buffer.DataBufferWrapper.retainedSlice(int, int)
org.springframework.core.io.buffer.DataBufferWrapper.slice(int, int)
org.springframework.core.io.buffer.DataBufferWrapper.toByteBuffer()
org.springframework.core.io.buffer.DataBufferWrapper.toByteBuffer(int, int)
org.springframework.core.io.buffer.DefaultDataBuffer.asByteBuffer()
org.springframework.core.io.buffer.DefaultDataBuffer.asByteBuffer(int, int)
org.springframework.core.io.buffer.DefaultDataBuffer.capacity(int)
org.springframework.core.io.buffer.DefaultDataBuffer.slice(int, int)
org.springframework.core.io.buffer.DefaultDataBuffer.toByteBuffer(int, int)
org.springframework.core.io.buffer.DefaultDataBufferFactory.allocateBuffer()
org.springframework.core.io.buffer.JettyDataBuffer.asByteBuffer()
org.springframework.core.io.buffer.JettyDataBuffer.asByteBuffer(int, int)
org.springframework.core.io.buffer.JettyDataBuffer.capacity(int)
org.springframework.core.io.buffer.JettyDataBuffer.slice(int, int)
org.springframework.core.io.buffer.JettyDataBuffer.toByteBuffer(int, int)
org.springframework.core.io.buffer.JettyDataBufferFactory.allocateBuffer()
org.springframework.core.io.buffer.Netty5DataBuffer.asByteBuffer()
org.springframework.core.io.buffer.Netty5DataBuffer.asByteBuffer(int, int)
org.springframework.core.io.buffer.Netty5DataBuffer.capacity(int)
org.springframework.core.io.buffer.Netty5DataBuffer.slice(int, int)
org.springframework.core.io.buffer.Netty5DataBuffer.toByteBuffer(int, int)
org.springframework.core.io.buffer.Netty5DataBufferFactory.allocateBuffer()
org.springframework.core.io.buffer.NettyDataBuffer.asByteBuffer()
org.springframework.core.io.buffer.NettyDataBuffer.asByteBuffer(int, int)
org.springframework.core.io.buffer.NettyDataBuffer.capacity(int)
org.springframework.core.io.buffer.NettyDataBuffer.retainedSlice(int, int)
org.springframework.core.io.buffer.NettyDataBuffer.slice(int, int)
org.springframework.core.io.buffer.NettyDataBuffer.toByteBuffer(int, int)
org.springframework.core.io.buffer.NettyDataBufferFactory.allocateBuffer()
org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames(Class<?>, ClassLoader)
as of 6.0 in favor of `SpringFactoriesLoader.load(Class, ArgumentResolver, FailureHandler)`
org.springframework.core.MethodParameter.decreaseNestingLevel()
since 5.2 in favor of retaining the original MethodParameter and using `MethodParameter.nested(Integer)` if nesting is required
org.springframework.core.MethodParameter.forMethodOrConstructor(Object, int)
as of 5.0, in favor of `MethodParameter.forExecutable(java.lang.reflect.Executable, int)`
org.springframework.core.MethodParameter.increaseNestingLevel()
since 5.2 in favor of `MethodParameter.nested(Integer)`
org.springframework.core.MethodParameter.setTypeIndexForCurrentLevel(int)
since 5.2 in favor of `MethodParameter.withTypeIndex(int)`
org.springframework.core.NestedExceptionUtils.buildMessage(String, Throwable)
as of 6.0, in favor of custom exception messages with selective inclusion of cause messages
org.springframework.core.task.AsyncListenableTaskExecutor.submitListenable(Runnable)
in favor of `AsyncTaskExecutor.submitCompletable(Runnable)`
org.springframework.core.task.AsyncListenableTaskExecutor.submitListenable(Callable<T>)
in favor of `AsyncTaskExecutor.submitCompletable(Callable)`
org.springframework.core.task.AsyncTaskExecutor.execute(Runnable, long)
as of 5.3.16 since the common executors do not support start timeouts
org.springframework.core.task.SimpleAsyncTaskExecutor.execute(Runnable, long)
org.springframework.util.ClassUtils.getInterfaceMethodIfPossible(Method)
in favor of `ClassUtils.getInterfaceMethodIfPossible(Method, Class)`
org.springframework.util.ClassUtils.isCglibProxy(Object)
as of 5.2, in favor of custom (possibly narrower) checks such as for a Spring AOP proxy
org.springframework.util.ClassUtils.isCglibProxyClass(Class<?>)
as of 5.2, in favor of custom (possibly narrower) checks or simply a check for containing `ClassUtils.CGLIB_CLASS_SEPARATOR`
org.springframework.util.ClassUtils.isCglibProxyClassName(String)
as of 5.2, in favor of custom (possibly narrower) checks or simply a check for containing `ClassUtils.CGLIB_CLASS_SEPARATOR`
org.springframework.util.concurrent.ListenableFuture.addCallback(ListenableFutureCallback<? super T>)
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.concurrent.ListenableFuture.addCallback(SuccessCallback<? super T>, FailureCallback)
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
org.springframework.util.ConcurrentLruCache.sizeLimit()
in favor of `ConcurrentLruCache.capacity()` as of 6.0.
org.springframework.util.ObjectUtils.nullSafeHashCode(boolean[])
as of 6.1 in favor of `Arrays.hashCode(boolean[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(byte[])
as of 6.1 in favor of `Arrays.hashCode(byte[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(char[])
as of 6.1 in favor of `Arrays.hashCode(char[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(double[])
as of 6.1 in favor of `Arrays.hashCode(double[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(float[])
as of 6.1 in favor of `Arrays.hashCode(float[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(int[])
as of 6.1 in favor of `Arrays.hashCode(int[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(long[])
as of 6.1 in favor of `Arrays.hashCode(long[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(short[])
as of 6.1 in favor of `Arrays.hashCode(short[])`
org.springframework.util.ObjectUtils.nullSafeHashCode(Object[])
as of 6.1 in favor of `Arrays.hashCode(Object[])`
org.springframework.util.PropertyPlaceholderHelper.parseStringValue(String, PropertyPlaceholderHelper.PlaceholderResolver)
org.springframework.util.SerializationUtils.deserialize(byte[])
This utility uses Java Object Serialization, which allows arbitrary code to be run and is known for being the source of many Remote Code Execution (RCE) vulnerabilities.

Prefer the use of an external tool (that serializes to JSON, XML, or any other format) which is regularly checked and updated for not allowing RCE.

org.springframework.util.StopWatch.getLastTaskInfo()
as of 6.1, in favor of `StopWatch.lastTaskInfo()`
org.springframework.util.StopWatch.getLastTaskName()
as of 6.1, in favor of `StopWatch.lastTaskInfo()`
org.springframework.util.StopWatch.getLastTaskTimeMillis()
as of 6.1, in favor of `StopWatch.lastTaskInfo()`
org.springframework.util.StopWatch.getLastTaskTimeNanos()
as of 6.1, in favor of `StopWatch.lastTaskInfo()`
org.springframework.util.StreamUtils.emptyInput()
as of 6.0 in favor of `InputStream.nullInputStream()`
org.springframework.util.StringUtils.isEmpty(Object)
as of 5.3, in favor of `StringUtils.hasLength(String)` and `StringUtils.hasText(String)` (or `ObjectUtils.isEmpty(Object)`)
org.springframework.util.StringUtils.trimLeadingWhitespace(String)
since 6.0, in favor of `String.stripLeading()`
org.springframework.util.StringUtils.trimTrailingWhitespace(String)
since 6.0, in favor of `String.stripTrailing()`
org.springframework.util.StringUtils.trimWhitespace(String)
since 6.0, in favor of `String.strip()`

Deprecated Constructors
Constructor
Description
org.springframework.aot.hint.support.FilePatternResourceHintsRegistrar(List<String>, List<String>, List<String>)
as of 6.0.12 in favor of the builder
org.springframework.asm.Handle(int, String, String, String)
this constructor has been superseded by `Handle(int, String, String, String, boolean)`.
org.springframework.core.type.StandardAnnotationMetadata(Class<?>)
since 5.2 in favor of the factory method `AnnotationMetadata.introspect(Class)`
org.springframework.core.type.StandardAnnotationMetadata(Class<?>, boolean)
since 5.2 in favor of the factory method `AnnotationMetadata.introspect(Class)`. Use `MergedAnnotation.asMap` from `StandardAnnotationMetadata.getAnnotations()` rather than `AnnotatedTypeMetadata.getAnnotationAttributes(String)` if `nestedAnnotationsAsMap` is `false`
org.springframework.core.type.StandardClassMetadata(Class<?>)
since 5.2 in favor of `StandardAnnotationMetadata`
org.springframework.core.type.StandardMethodMetadata(Method)
since 5.2 in favor of obtaining instances via `AnnotationMetadata`
org.springframework.util.PropertyPlaceholderHelper(String, String, String, boolean)
as of 6.2, in favor of `PropertyPlaceholderHelper(String, String, String, Character, boolean)`