Spring Boot 4 Launches with Jakarta EE 11, JSpecify Null‑Safety, and AI‑Ready Features
Spring Boot 4 arrives alongside Spring Framework 7, upgrading to Jakarta EE 11, JDK 25, JSpecify null‑safety, build‑time optimizations, a declarative HTTP client, full Jackson 3 support, native API versioning, built‑in resilience, OpenTelemetry integration, and a dual‑track Spring AI strategy.
In November, the Spring team released a coordinated set of major versions—Spring Framework 7, Spring Boot 4, Spring Data 2025.1, and Spring AI 1.1—representing a deep rewrite of the entire ecosystem rather than a routine upgrade.
Underlying dependencies upgrade : Spring Framework 7 retains compatibility with JDK 17 but recommends the latest LTS JDK 25 and adopts Jakarta EE 11 as the new baseline. The legacy javax.* packages are removed, requiring migration of annotations such as @javax.annotation.PostConstruct and @javax.inject.Inject to the jakarta.* namespace. Updated components include Servlet 6.1 (Tomcat 11.0 / Jetty 12.1), JPA 3.2 (Hibernate 7.1/7.2), Bean Validation 3.1 (Hibernate Validator 9.0+), WebSocket 2.2, Kotlin 2.2, and GraalVM 25.
Null‑safety revolution : The framework codebase now uses JSpecify annotations instead of JSR‑305, improving Kotlin‑Java interop and providing precise null‑semantic descriptions for generics, arrays, and varargs.
Build‑time optimization with Project Leyden : Spring’s traditional runtime magic—classpath scanning, dynamic proxies, reflection, and conditional auto‑configuration—is shifted to build time, reducing startup latency and simplifying native image generation.
Modern HTTP client and testing toolchain : RestTemplate enters deprecation (marked @Deprecated in 7.1). A new declarative HTTP client using @HttpExchange and @ImportHttpServices auto‑generates implementations. RestTestClient replaces the reactive WebTestClient as a non‑reactive alternative, supporting MockMvc and real servers with automatic context pause/resume to lower resource usage.
Full‑stack Jackson 3 support : The default JSON library switches to tools.jackson (Jackson 3.x). Jackson 2 is deprecated and will be removed in 7.2; migration guidance points to JsonMapper.builder() while retaining com.fasterxml.jackson annotations for compatibility.
Native API versioning : Spring MVC and WebFlux now provide built‑in API version management via spring.mvc.apiversion.* and spring.webflux.apiversion.*, allowing version resolution through headers, parameters, or media types and marking versions as deprecated. Full‑stack support is offered by RestClient, WebClient, and WebTestClient.
Resilience primitives in the core : Spring acknowledges that distributed systems default to failure and therefore embeds retry, rate‑limiting, and circuit‑breaker capabilities directly in spring‑core. Example usage:
@Retryable(maxAttempts = 3)
public List<Order> getOrders() { ... }Developers no longer need to add spring-retry, Resilience4j, or extra configuration.
Modular auto‑configuration : The auto‑configuration modules are split into finer‑grained units, resulting in more precise error messages, lighter AOT‑generated code, and a reduced analysis scope for native images.
OpenTelemetry integration : The new spring-boot-starter-opentelemetry starter brings native OpenTelemetry support, tightly integrated with Micrometer to export metrics, traces, and logs via OTLP.
AI dual‑track strategy : Spring AI now follows two parallel paths. Spring AI 1.1 offers stable, starter‑based integration with major LLM providers and declarative tool registration via ChatClient. Spring AI 2.x, aligned with Boot 4 and Jakarta EE 11, is a deep rewrite that incorporates JSpecify null‑safety, MCP, and AOT compilation, providing separate reactive and blocking client APIs.
Migration options : (1) Spring Framework 6 + Spring Boot 3 + Spring AI 1.1 – a stable, mature stack for maintenance‑focused systems. (2) Spring Framework 7 + Spring Boot 4 + Spring AI 2.x – an aggressive, forward‑looking stack for the next decade.
SpringMeng
Focused on software development, sharing source code and tutorials for various systems.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
