Spring Boot 4.0 Release: Major Upgrades, Build‑Time Optimizations, and AI Roadmap
Spring Boot 4.0 launches alongside Spring Framework 7, Spring Data 2025.1 and Spring AI 1.1, delivering a sweeping upgrade that moves the stack to Jakarta EE 11, JDK 25, JSpecify null‑safety, build‑time optimizations, native OpenTelemetry support, and a dual‑track AI strategy.
Spring Boot 4.0 has been officially released, coinciding with a coordinated launch of Spring Framework 7, Spring Data 2025.1 and Spring AI 1.1. This batch release is not a routine patch but a deep, ecosystem‑wide refactor aimed at the next decade of development.
1. Core Platform Upgrade
The underlying platform now targets Jakarta EE 11 and JDK 25 . While compatibility with JDK 17 remains, the recommended baseline is the latest LTS release. All javax.* packages are removed; annotations such as @javax.annotation.PostConstruct and @javax.inject.Inject must be migrated to the jakarta.* namespace. Updated dependencies include:
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 and GraalVM 25 support
2. Null‑Safety Revolution
Spring’s codebase now adopts JSpecify annotations, replacing the older JSR‑305 style. This brings precise nullability contracts for generics, arrays and var‑args, improving Kotlin‑Java inter‑operability.
3. Build‑Time Optimizations (Project Leyden)
Spring moves many runtime mechanisms—classpath scanning, dynamic proxies, reflection, and conditional auto‑configuration—into the build phase. The goal is to perform all possible work at compile time, reducing startup latency and simplifying native image generation.
4. Modern HTTP Client & Test Toolchain
RestTemplateis now deprecated (will be marked @Deprecated in 7.1). A new declarative HTTP client using @HttpExchange and @ImportHttpServices generates implementations automatically. The RestTestClient replaces WebTestClient for non‑reactive testing, offering MockMvc‑style capabilities with automatic context pause/resume.
5. Full‑Stack Jackson 3 Support
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 in com.fasterxml.jackson for compatibility. Jackson2ObjectMapperBuilder is superseded by JsonMapper.builder().
6. Native API Versioning
Spring MVC and WebFlux provide built‑in API version management via request headers, parameters or media types. Configuration properties spring.mvc.apiversion.* and spring.webflux.apiversion.* auto‑configure version handling for RestClient, WebClient and WebTestClient.
7. Built‑In Resilience Features
Spring now treats failure as the default state of distributed systems. Retry, rate‑limiting and circuit‑breaker capabilities are native to spring‑core. Example:
@Retryable(maxAttempts = 3)
public List<Order> getOrders() { ... }Developers no longer need to add spring-retry, Resilience4j dependencies or extra configuration.
8. 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 surface for native images.
9. OpenTelemetry Integration
The new spring-boot-starter-opentelemetry starter brings first‑class OpenTelemetry support, tightly integrated with Micrometer to export metrics, traces and logs via OTLP.
10. AI Dual‑Track Strategy
Spring AI now follows two parallel roadmaps:
Spring AI 1.1 – stable, starter‑based integration with major LLM providers, automatic MCP/JSON mapping, and deep ChatClient integration.
Spring AI 2.x – future‑focused, rebuilt for Spring Boot 4 and Jakarta EE 11, with JSpecify null‑safety, MCP and AOT tightly woven into the core.
Consequently, two migration paths are recommended:
Framework 6 + Boot 3 + AI 1.1 – stable, mature, suited for long‑term maintenance.
Framework 7 + Boot 4 + AI 2.x – aggressive, forward‑looking, targeting the next decade.
The accompanying diagram illustrates the version alignment:
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.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
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.
