What’s New in Spring Boot 4? A Deep Dive into the Latest Spring Ecosystem Overhaul
Spring Boot 4 launches alongside Spring Framework 7, Spring Data 2025.1 and Spring AI 1.1, delivering a massive upgrade that includes Jakarta EE 11, JDK 25, null‑safety via JSpecify, build‑time optimizations, modern HTTP clients, full‑stack Jackson 3 support, native resilience features, modular auto‑configuration, OpenTelemetry integration, and a dual‑track AI strategy.
Spring Boot 4, Spring Framework 7, Spring Data 2025.1 and Spring AI 1.1 have been released together, introducing a coordinated upgrade of the Spring ecosystem.
Core Dependency Upgrade
Spring Framework 7 targets Jakarta EE 11 as the baseline and recommends JDK 25 (while still supporting JDK 17). Key component versions are:
Servlet 6.1 (Tomcat 11.0 / Jetty 12.1)
JPA 3.2 (Hibernate ORM 7.1/7.2)
Bean Validation 3.1 (Hibernate Validator 9.0+)
WebSocket 2.2
Kotlin 2.2 with GraalVM 25
The javax.* namespace is removed; annotations such as @javax.annotation.PostConstruct and @javax.inject.Inject must be migrated to jakarta.*. Undertow is no longer supported, and the underlying implementations of WebFlux and WebSocket have been adjusted accordingly.
Null‑Safety with JSpecify
Spring’s codebase now uses JSpecify annotations instead of JSR‑305. This provides precise null‑semantic definitions for generics, arrays and varargs and improves Kotlin‑Java interoperability. Projects are encouraged to adopt JSpecify to achieve true null‑safe code.
Build‑Time Optimisation (Project Leyden)
Traditional runtime mechanisms—classpath scanning, dynamic proxies, reflection and auto‑configuration condition checks—are shifted to the build phase. This reduces startup time and simplifies native‑image generation.
Modern HTTP Client & Test Toolchain
RestTemplateis deprecated (will be marked @Deprecated in 7.1).
Declarative HTTP client via @HttpExchange generates implementations automatically.
Group configuration supported through @ImportHttpServices.
New RestTestClient provides a non‑reactive alternative to WebTestClient, usable with MockMvc or real servers.
Test context can auto‑pause/resume to reduce resource consumption.
Jackson 3 as Default
Spring now defaults to Jackson 3.x (package tools.jackson). Jackson 2 is deprecated and will be removed in Spring 7.2. Migration notes:
Annotations remain under com.fasterxml.jackson for easier transition. Jackson2ObjectMapperBuilder is removed; use JsonMapper.builder() instead.
Native API Versioning
Spring MVC and WebFlux include built‑in API version management. Versions can be resolved via request headers, parameters or media types, marked as deprecated, and propagated through the full client chain ( RestClient, WebClient, WebTestClient) using the properties spring.mvc.apiversion.* and spring.webflux.apiversion.*.
Built‑In Resilience
Common resilience patterns are now part of the core framework. Example:
@Retryable(maxAttempts = 3)
public List<Order> getOrders() { /* ... */ }No additional dependencies such as spring-retry or Resilience4j are required.
Modular Auto‑Configuration
Auto‑configuration has been split into finer‑grained modules, resulting in more accurate IDE hints, lighter AOT code generation and a smaller analysis scope for native images.
OpenTelemetry Integration
The new spring-boot-starter-opentelemetry starter integrates OpenTelemetry with Micrometer, providing native support for metrics, traces and logs (OTLP export).
Spring AI Dual‑Track Strategy
Spring AI 1.1 – stable release with starter‑based integration for major LLM providers, automatic handling of MCP, JSON mapping and tool binding; deep integration with ChatClient for declarative tool registration.
Spring AI 2.x – future‑focused rewrite aligned with Spring Boot 4 and Jakarta EE 11; refactored ChatClient API separating reactive and blocking paths; built‑in JSpecify null‑safety; deeper MCP/AOT integration for build‑time proxy optimisation.
Choosing a Track
Spring Framework 6 + Spring Boot 3 + Spring AI 1.1 – stable, mature, suited for maintenance‑oriented systems.
Spring Framework 7 + Spring Boot 4 + Spring AI 2.x – aggressive, forward‑looking, designed for the next decade.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Su San Talks Tech
Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.
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.
