Spring Boot 4.0 Released: Core New Features and Upgrade Guide

Spring Boot 4.0, built on Spring Framework 7.0, introduces HTTP Service Clients, native API versioning, full JSpecify null‑safety, Java 25 support, upgraded dependencies, Gradle 9 compatibility, Redis static master‑replica configuration, and drops Undertow, with migration advice to move through 3.5 first.

JavaGuide
JavaGuide
JavaGuide
Spring Boot 4.0 Released: Core New Features and Upgrade Guide

New Feature Overview

HTTP Service Clients (finally here!)

Developers no longer need to write boilerplate RestTemplate or WebClient code. By defining a simple interface annotated with @HttpExchange, Spring Boot automatically generates the implementation.

// Only define an interface, Spring Boot creates the implementation
@HttpExchange(url = "https://echo.zuplo.io")
public interface EchoService {
    @PostExchange
    Map<?, ?> echo(@RequestBody Map<String, String> message);
}

This feature provides full auto‑configuration and property support, making inter‑service calls as straightforward as local method invocations.

Native API Version Management

API versioning, a traditionally tricky problem for backend development, is now supported out‑of‑the‑box for both Spring MVC and WebFlux. By configuring properties such as spring.mvc.apiversion.* or spring.webflux.apiversion.*, or by providing a custom ApiVersionResolver bean, developers can implement URL‑path, header‑based, or parameter‑based versioning strategies with minimal effort.

Gradle 9 Support

Spring Boot 4.0 can be built with Gradle 9 while retaining compatibility with Gradle 8.x (8.14 or newer).

Full Adoption of JSpecify Null‑Safety

Spring Boot 4.0 embraces the JSpecify null‑safety model. The core change is the default non‑null annotation @NullMarked combined with explicit @Nullable markings. This turns potential runtime NullPointerExceptions into compile‑time errors.

Method signatures clearly indicate which return values and parameters can be null.

When used with tools like NullAway, missing null checks cause compilation failures.

Zero runtime overhead and full compatibility with existing code.

More lightweight than Optional, suitable for large‑scale refactoring.

Full Java 25 Support

The release provides top‑level support for Java 25 while still being compatible with the LTS Java 17. Enabling virtual threads via spring.threads.virtual.enabled=true in application.properties makes the auto‑configured JDK HttpClient use virtual threads, delivering significant performance gains for I/O‑bound workloads.

Dependency Version Leap

Spring Boot 4.0 upgrades the entire “dependency bucket”: Spring Framework 7.0, Jackson 3.0, Hibernate 7.1, Tomcat 11, Jetty 12, Kafka 4.1, Kotlin 2.2.20, and more. This collective upgrade brings performance, security, and new feature improvements across the stack.

Redis Static Master‑Slave Support

Lettuce users can now configure static master‑replica mode with a single property spring.data.redis.masterreplica.nodes, eliminating the need for Sentinel or Cluster setups.

Undertow Removal

Embedded Undertow support is completely removed. The spring-boot-starter-undertow starter and all related auto‑configurations are gone because Spring Boot 4.0 upgrades the baseline to Servlet 6.1, and Undertow has not yet been compatible with that version.

Upgrade Recommendations

Because 4.0 is a major version, the official guidance suggests upgrading first to 3.5 before moving to 4.0. This staged path avoids most migration pitfalls.

Detailed migration steps are available in the official migration guide: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide .

Conclusion

Spring Boot 4.0.0, based on Spring Framework 7.0, fully supports Java 25 (including virtual thread optimizations). Key new features include simplified HTTP Service Clients, native API versioning, comprehensive JSpecify null‑safety, a large dependency upgrade set, Gradle 9 compatibility, Redis static master‑replica configuration, and the removal of Undertow. For a smooth upgrade, migrate first to 3.5.

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.

API VersioningRedisspring-bootSpring FrameworkJSpecifyJava 25Gradle 9HTTP Service Clients
JavaGuide
Written by

JavaGuide

Backend tech guide and AI engineering practice covering fundamentals, databases, distributed systems, high concurrency, system design, plus AI agents and large-model engineering.

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.