Skip navigation links
spring-core
  • Overview
  • Package
  • Class
  • Use
  • Tree
  • Deprecated
  • Index
  • Help

Deprecated API

Contents

  • Terminally Deprecated
  • Interfaces
  • Classes
  • Exceptions
  • Fields
  • Methods
  • Constructors
  • Terminally Deprecated Elements
    Element
    Description
    org.springframework.util.Assert.doesNotContain(String, String)
    as of 4.3.7, in favor of Assert.doesNotContain(String, String, String); to be removed in 6.1
    org.springframework.util.Assert.hasLength(String)
    as of 4.3.7, in favor of Assert.hasLength(String, String); to be removed in 6.1
    org.springframework.util.Assert.hasText(String)
    as of 4.3.7, in favor of Assert.hasText(String, String); to be removed in 6.1
    org.springframework.util.Assert.isNull(Object)
    as of 4.3.7, in favor of Assert.isNull(Object, String); to be removed in 6.1
    org.springframework.util.Assert.isTrue(boolean)
    as of 4.3.7, in favor of Assert.isTrue(boolean, String); to be removed in 6.1
    org.springframework.util.Assert.noNullElements(Object[])
    as of 4.3.7, in favor of Assert.noNullElements(Object[], String); to be removed in 6.1
    org.springframework.util.Assert.notEmpty(Object[])
    as of 4.3.7, in favor of Assert.notEmpty(Object[], String); to be removed in 6.1
    org.springframework.util.Assert.notEmpty(Collection<?>)
    as of 4.3.7, in favor of Assert.notEmpty(Collection, String); to be removed in 6.1
    org.springframework.util.Assert.notEmpty(Map<?, ?>)
    as of 4.3.7, in favor of Assert.notEmpty(Map, String); to be removed in 6.1
    org.springframework.util.Assert.notNull(Object)
    as of 4.3.7, in favor of Assert.notNull(Object, String); to be removed in 6.1
    org.springframework.util.Assert.state(boolean)
    as of 4.3.7, in favor of Assert.state(boolean, String); to be removed in 6.1
    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
  • 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.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.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.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)
    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(), which does not share data and returns a copy.
    org.springframework.core.io.buffer.DataBuffer.asByteBuffer(int, int)
    as of 6.0, in favor of DataBuffer.toByteBuffer(int, int), which does not share data and returns a copy.
    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.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.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.DefaultDataBufferFactory.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.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.core.task.support.TaskExecutorAdapter.execute(Runnable, long)
    org.springframework.util.Assert.doesNotContain(String, String)
    as of 4.3.7, in favor of Assert.doesNotContain(String, String, String); to be removed in 6.1
    org.springframework.util.Assert.hasLength(String)
    as of 4.3.7, in favor of Assert.hasLength(String, String); to be removed in 6.1
    org.springframework.util.Assert.hasText(String)
    as of 4.3.7, in favor of Assert.hasText(String, String); to be removed in 6.1
    org.springframework.util.Assert.isNull(Object)
    as of 4.3.7, in favor of Assert.isNull(Object, String); to be removed in 6.1
    org.springframework.util.Assert.isTrue(boolean)
    as of 4.3.7, in favor of Assert.isTrue(boolean, String); to be removed in 6.1
    org.springframework.util.Assert.noNullElements(Object[])
    as of 4.3.7, in favor of Assert.noNullElements(Object[], String); to be removed in 6.1
    org.springframework.util.Assert.notEmpty(Object[])
    as of 4.3.7, in favor of Assert.notEmpty(Object[], String); to be removed in 6.1
    org.springframework.util.Assert.notEmpty(Collection<?>)
    as of 4.3.7, in favor of Assert.notEmpty(Collection, String); to be removed in 6.1
    org.springframework.util.Assert.notEmpty(Map<?, ?>)
    as of 4.3.7, in favor of Assert.notEmpty(Map, String); to be removed in 6.1
    org.springframework.util.Assert.notNull(Object)
    as of 4.3.7, in favor of Assert.notNull(Object, String); to be removed in 6.1
    org.springframework.util.Assert.state(boolean)
    as of 4.3.7, in favor of Assert.state(boolean, String); to be removed in 6.1
    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
    org.springframework.util.ClassUtils.isCglibProxyClass(Class<?>)
    as of 5.2, in favor of custom (possibly narrower) checks
    org.springframework.util.ClassUtils.isCglibProxyClassName(String)
    as of 5.2, in favor of custom (possibly narrower) checks
    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.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.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.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