Backend Development 4 min read

What’s New in Spring 6? Key Changes for Jakarta EE Migration and Web Development

Spring 6 introduces major updates such as moving JSR‑330 and JSR‑250 annotations to Jakarta packages, deprecating ListenableFuture, requiring Hibernate 5.6.x with jakarta.persistence, updating servlet containers, altering controller detection, converting HttpMethod to a class, and adjusting Kotlin and RestTemplate APIs.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
What’s New in Spring 6? Key Changes for Jakarta EE Migration and Web Development

Core Changes

The

@Inject

annotation from JSR‑330 is now located in the

jakarta.inject

package. JSR‑250 annotations

@PostConstruct

and

@PreDestroy

have moved to

jakarta.annotation

. Spring still detects these annotations under the

javax

package, including common usage in pre‑compiled binaries.

ListenableFuture

has been deprecated and fully replaced by

CompletableFuture

(see issue 27780).

Data and Transactions

Due to the Jakarta EE migration, upgrade to Hibernate ORM 5.6.x and use the

hibernate-core-jakarta

artifact, switching imports from

javax.persistence

to

jakarta.persistence

. The corresponding Hibernate Validator version is 7.0.x, based on

jakarta.validation

.

Web Applications

Upgrade to Tomcat 10, Jetty 11, or Undertow 2.2.14 and use the

undertow-servlet-jakarta

component, changing imports from

javax.servlet

to

jakarta.servlet

. Deprecated servlet components include Commons FileUpload, Tiles, and FreeMarker JSP support; use

StandardServletMultipartResolver

for file uploads and focus on a REST‑oriented architecture.

Spring MVC and Spring WebFlux no longer treat

@RequestMapping

alone as a controller. Interface‑based AOP proxies may not apply; enable class‑based proxies or annotate interfaces with

@Controller

(see issue 22154).

HttpMethod

is now a class instead of an enum. Code using

EnumSet<HttpMethod>

should switch to

Set<HttpMethod>

and use

if‑else

rather than

switch

(see issue 27697).

Kotlin extension function

WebTestClient.ResponseSpec::expectBody

now returns

BodySpec

instead of

KotlinBodySpec

. The

consumeWith

method is no longer available. Spring 6.0 uses Kotlin 1.6, fixing bug KT‑5464.

RestTemplate’s

HttpComponentsClientHttpRequestFactory

now requires Apache HttpClient 5.

backendJavaMigrationSpringweb developmentJakarta EE
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.