Deprecations in Spring Boot 2.3
Reflecting the Spring Boot release compatibility policy, code deprecated in Spring Boot 2.3 has been removed in Spring Boot 2.5. Code deprecated in Spring Boot 2.4 remains in place, and is scheduled for removal in Spring Boot 2.6.
This recipe must run before the Spring Boot dependencies are upgraded from 2.4 to 2.5!
The deprecations in 2.3 are removed in 2.5. So before upgrading to 2.5 all deprecations must be replaced.
Reflecting the Spring Boot release compatibility policy, code deprecated in Spring Boot 2.3 has been removed in Spring Boot 2.5. Code deprecated in Spring Boot 2.4 remains in place, and is scheduled for removal in Spring Boot 2.6.
This recipe must run before the Spring Boot dependencies are upgraded from 2.4 to 2.5!
The deprecations in 2.3 are removed in 2.5. So before upgrading to 2.5 all deprecations must be replaced.
-
Deprecated Packages
Package and Description
org.springframework.boot.jta.bitronix
since 2.3.0 for removal in 2.5.0 as the Bitronix project is no longer being maintained
-
Deprecated Interfaces
Interface and Description
org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientBuilderCustomizer
since 2.3.1 for removal in 2.5 in favor of
RestClientBuilderCustomizer -
Deprecated Classes
Class and Description
org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor
since 2.3.0 for removal in 2.5.0 as the Bitronix project is no longer being maintained
org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper
since 2.3.0 for removal in 2.5.0 as the Bitronix project is no longer being maintained
org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper
since 2.3.0 for removal in 2.5.0 as the Bitronix project is no longer being maintained
org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner
since 2.3.0 for removal in 2.5.0 in favor of
JobLauncherApplicationRunnerorg.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean
since 2.3.0 for removal in 2.5.0 as the Bitronix project is no longer being maintained
org.springframework.boot.jta.bitronix.PoolingDataSourceBean
since 2.3.0 for removal in 2.5.0 as the Bitronix project is no longer being maintained
org.springframework.boot.actuate.autoconfigure.metrics.ServiceLevelAgreementBoundary
since 2.3.0 for removal in 2.5.0 in favor of
ServiceLevelObjectiveBoundaryorg.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration
since 2.3.9 for removal in 2.5 as Spring Data Solr is deprecated
-
Deprecated Methods
Method and Description
since 2.3.0 for removal in 2.5.0
org.springframework.boot.test.context.assertj.ApplicationContextAssertProvider.assertThat()
to prevent accidental use. Prefer standard AssertJ
assertThat(context)...calls instead.org.springframework.boot.test.json.JsonContent.assertThat()
to prevent accidental use. Prefer standard AssertJ
assertThat(context)...calls instead.org.springframework.boot.loader.Launcher.createClassLoader(List<Archive>)
since 2.3.0 for removal in 2.5.0 in favor of
Launcher.createClassLoader(Iterator)org.springframework.boot.loader.archive.Archive.forEach(Consumer<? super Archive.Entry>)
since 2.3.0 for removal in 2.5.0 in favor of using
JarFileto access entries andArchive.getNestedArchives(EntryFilter, EntryFilter)for accessing nested archives.org.springframework.boot.loader.Launcher.getClassPathArchives()
since 2.3.0 for removal in 2.5.0 in favor of implementing
Launcher.getClassPathArchivesIterator().org.springframework.boot.autoconfigure.cassandra.CassandraProperties.getClusterName()
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.getConnectTimeout()
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.getConsistencyLevel()
org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties.getDateFormat()
org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties.getDateFormat()
since 2.3.0 for removal in 2.5.0 in favor of
AbstractErrorController.getErrorAttributes(HttpServletRequest, ErrorAttributeOptions)since 2.3.0 for removal in 2.5.0 in favor of
ErrorAttributes.getErrorAttributes(ServerRequest, ErrorAttributeOptions)since 2.3.0 for removal in 2.5.0 in favor of
AbstractErrorWebExceptionHandler.getErrorAttributes(ServerRequest, ErrorAttributeOptions)org.springframework.boot.web.servlet.error.ErrorAttributes.getErrorAttributes(WebRequest, boolean)
since 2.3.0 for removal in 2.5.0 in favor of
ErrorAttributes.getErrorAttributes(WebRequest, ErrorAttributeOptions)org.springframework.boot.web.servlet.error.ErrorController.getErrorPath()
since 2.3.0 for removal in 2.5.0 in favor of setting the property `server.error.path`
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.getFetchSize()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getHostHeader()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getInternalProxies()
org.springframework.boot.autoconfigure.web.ServerProperties.Undertow.getIoThreads()
org.springframework.boot.loader.tools.Layouts.Jar.getLibraryDestination(String, LibraryScope)
org.springframework.boot.loader.tools.Layouts.War.getLibraryDestination(String, LibraryScope)
org.springframework.boot.loader.tools.Layout.getLibraryDestination(String, LibraryScope)
since 2.3.0 for removal in 2.5.0 in favor of
Layout.getLibraryLocation(java.lang.String, org.springframework.boot.loader.tools.LibraryScope)org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.getMaxQueueCapacity()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getMaxThreads()
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.getMaxThreads()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getMinSpareThreads()
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.getMinThreads()
org.springframework.boot.loader.archive.Archive.getNestedArchives(Archive.EntryFilter)
since 2.3.0 for removal in 2.5.0 in favor of
Archive.getNestedArchives(EntryFilter, EntryFilter)org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getPortHeader()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getProtocolHeader()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getProtocolHeaderHttpsValue()
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.getReadTimeout()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getRemoteIpHeader()
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.getSelectors()
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.getSerialConsistencyLevel()
org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties.Distribution.getSla()
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.getThreadIdleTimeout()
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.getUseRelativeRedirects()
org.springframework.boot.autoconfigure.web.ServerProperties.Undertow.getWorkerThreads()
org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.isEndpointExposed(Object)
org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.isExtensionExposed(Object)
org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties.Pathmatch.isUseSuffixPattern()
org.springframework.boot.loader.archive.JarFileArchive.iterator()
org.springframework.boot.loader.archive.Archive.iterator()
since 2.3.0 for removal in 2.5.0 in favor of using
JarFileto access entries andArchive.getNestedArchives(EntryFilter, EntryFilter)for accessing nested archives.org.springframework.boot.loader.archive.ExplodedArchive.iterator()
org.springframework.boot.SpringApplication.refresh(ApplicationContext)
since 2.3.0 for removal in 2.5.0 in favor of
SpringApplication.refresh(ConfigurableApplicationContext)org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.setAcceptors(Integer)
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.setClusterName(String)
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.setConnectTimeout(Duration)
org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties.setDateFormat(String)
org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties.setDateFormat(String)
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.setFetchSize(int)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setHostHeader(String)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setInternalProxies(String)
org.springframework.boot.autoconfigure.web.ServerProperties.Undertow.setIoThreads(Integer)
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.setMaxQueueCapacity(Integer)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setMaxThreads(int)
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.setMaxThreads(Integer)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setMinSpareThreads(int)
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.setMinThreads(Integer)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setPortHeader(String)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setProtocolHeader(String)
org.springframework.boot.autoconfigure.cassandra.CassandraProperties.setReadTimeout(Duration)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setRemoteIpHeader(String)
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.setSelectors(Integer)
org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.setThreadIdleTimeout(Duration)
org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.setUseRelativeRedirects(Boolean)
org.springframework.boot.autoconfigure.web.ServerProperties.Undertow.setWorkerThreads(Integer)
org.springframework.boot.loader.archive.Archive.spliterator()
since 2.3.0 for removal in 2.5.0 in favor of using
JarFileto access entries andArchive.getNestedArchives(EntryFilter, EntryFilter)for accessing nested archives.since 2.3.0 for removal in 2.5.0 in favor of
WebClientExchangeTags.status(ClientResponse, Throwable)org.springframework.boot.actuate.metrics.web.reactive.client.WebClientExchangeTags.status(Throwable)
since 2.3.0 for removal in 2.5.0 in favor of
WebClientExchangeTags.status(ClientResponse, Throwable)org.springframework.boot.actuate.autoconfigure.metrics.MeterValue.valueOf(long)
since 2.3.0 for removal in 2.5.0 in favor of
MeterValue.valueOf(double) -
Deprecated Constructors
Constructor and Description
org.springframework.boot.web.servlet.error.DefaultErrorAttributes(boolean)
since 2.3.0 for removal in 2.5.0 in favor of
ErrorAttributeOptions.including(Include...)org.springframework.boot.web.reactive.error.DefaultErrorAttributes(boolean)
since 2.3.0 for removal in 2.5.0 in favor of
ErrorAttributeOptions.including(Include...)org.springframework.boot.autoconfigure.mongo.MongoClientFactory(MongoProperties, Environment)
since 2.3.0 for removal in 2.5.0 in favor of
MongoClientFactory(MongoProperties, Environment, List)org.springframework.boot.loader.tools.Packager(File, LayoutFactory)
since 2.3.10 for removal in 2.5 in favor of
Packager(File)andPackager.setLayoutFactory(LayoutFactory)org.springframework.boot.loader.tools.Repackager(File, LayoutFactory)
since 2.3.10 for removal in 2.5 in favor of
Repackager(File)andPackager.setLayoutFactory(LayoutFactory)since 2.3.0 for removal in 2.5.0 in favor of
UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)since 2.3.0 for removal in 2.5.0 in favor of
UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)since 2.3.0 for removal in 2.5.0 in favor of
UndertowServletWebServer(io.undertow.Undertow.Builder, Iterable, String, boolean)since 2.3.0 for removal in 2.5.0 in favor of
UndertowWebServer(io.undertow.Undertow.Builder, Iterable, boolean)org.springframework.boot.autoconfigure.web.format.WebConversionService(String)
since 2.3.0 for removal in 2.5.0 in favor of
WebConversionService(DateTimeFormatters) -
Deprecated Enum Constants
Enum Constant and Description
org.springframework.boot.autoconfigure.web.ErrorProperties.IncludeStacktrace.ON_TRACE_PARAM
JTA-Bitronix deprecation to be looked at in #168
Prefer using AssertJ assertThat: #169
org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration is a similar case - the whole lib is deprecated thus I'd leave usages of API from the lib as is for manual removal.
org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvoker.apply(OperationInvoker, long) - no obvious replacement. Leave as is?
I think we're likely already doing a decent job at the most often used replacements here; given the age of the issue I'm going to close this one , although contributions for anything missed are still welcome.