What’s New in Spring Framework 6.0? Key Changes and Migration Guide

Spring Framework 6.0 milestone introduces Jakarta EE package migrations, updates core containers, overhauls persistence APIs, modernizes servlet middleware with Tomcat 10, Jetty 11, Undertow 2.2.14, removes legacy components, and changes controller scanning and HttpMethod handling, while offering resources for learning Spring Boot and Cloud.

Programmer DD
Programmer DD
Programmer DD
What’s New in Spring Framework 6.0? Key Changes and Migration Guide

Spring Framework 6.0 first milestone version has been released and is available from the Spring repository. Below are the notable new changes.

Java EE Migration

Oracle donated Java EE to the Eclipse Foundation years ago. The name has changed to Jakarta EE , and package prefixes have moved from javax to jakarta. For example, javax.persistence is now jakarta.persistence.

Core Containers

The two core container specifications JSR-250 and JSR-330 are also migrating their packages to Jakarta EE in this milestone.

Persistence Layer

Jakarta EE's persistence specifications are migrated, meaning javax.persistence and jakarta.validation are now implemented by Hibernate ORM 5.6.x and Hibernate Validator 7.0.x .

Web Application – Servlet Middleware Baseline

Due to the Jakarta EE migration, servlet middleware must be upgraded. The baseline for this milestone includes Tomcat 10 , Jetty 11 , or undertow-servlet-jakarta based Undertow 2.2.14 .

Removal of Outdated APIs

Commons FileUpload upload component has been removed.

Template engines such as Tiles , FreeMarker , and JSP are no longer supported; Spring now focuses on RESTful web architecture.

Controller Scanning Changes

In Spring MVC and Spring WebFlux, classes annotated only with @RequestMapping are no longer considered controllers. Previously, the following code was valid:

/**
 * 6.0之前
 * @author felord.cn
 */
@Component
@RequestMapping("/foo")
public class FooController {
    @GetMapping("/hello")
    public Map<String, String> hello() {
        return Collections.singletonMap("hello", "world");
    }
}

After 6.0, such classes require class‑based proxying for AOP, and must be annotated with @Controller or @RestController to be recognized as controllers.

HttpMethod Changes

Before 6.0, HttpMethod was a Java enum. Example:

/**
 * 6.0 之前
 * @since 3.0
 */
public enum HttpMethod {
    GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
    private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
    static {
        for (HttpMethod httpMethod : values()) {
            mappings.put(httpMethod.name(), httpMethod);
        }
    }
    @Nullable
    public static HttpMethod resolve(@Nullable String method) {
        return (method != null ? mappings.get(method) : null);
    }
    public boolean matches(String method) {
        return name().equals(method);
    }
}

From 6.0 onward, HttpMethod is a final class with static instances such as HttpMethod.GET, HttpMethod.HEAD, etc.

public final class HttpMethod implements Comparable<HttpMethod>, Serializable {
    private static final long serialVersionUID = -70133475680645360L;
    private static HttpMethod[] values;
    private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
    public static final HttpMethod GET = new HttpMethod("GET");
    public static final HttpMethod HEAD = new HttpMethod("HEAD");
    public static final HttpMethod POST = new HttpMethod("POST");
    public static final HttpMethod PUT = new HttpMethod("PUT");
    // ... other methods omitted
}
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backend DevelopmentServletSpring MVCSpring Frameworkjakarta-ee
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

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.