Maru@maru

Dev Hub

Translated from Korean

Spring Boot 4 Released and Key Changes: From API Versioning to Bean Registration

Spring Boot 4.0 has officially arrived, based on Spring Framework 7.0 and Jakarta EE 11. Requiring at least Java 17 and extending support up to the latest Java 25, this major release focuses on developer productivity and framework optimization. It absorbs areas that previously relied on complex custom configurations into built-in framework features and streamlines the module structure, significantly enhancing day-to-day developer convenience.

Native API Versioning Support

The most notable change is native API versioning at the controller level. Previously, in real-world scenarios, developers had to manually include versions in URL paths or implement custom interceptors to parse headers for request routing. Spring Boot 4 simplifies this process by providing a version attribute directly in mapping annotations.

An example of a simple version-routing controller based on Spring Boot 4.0.

java

Desired versioning strategies—such as URL paths, request headers, query parameters, or media types—can be configured globally via WebMvcConfigurer. It is now possible to intuitively separate version-specific handler methods while maintaining the same endpoint paths.

Programmatic Bean Registration and JSpecify Adoption

Dynamic bean registration has also been improved. Previously, dynamic conditional registration of multiple beans at runtime required complex implementations of bean factory post-processors. Using the newly added BeanRegistrar interface, you can register beans with intuitive lambdas or helper methods within declarative code, which is highly useful for library developers or those configuring complex multi-tenancy environments.

Regarding code stability, the JSpecify null-safety standard annotations have been introduced across the portfolio. This allows for the preemptive detection of potential NullPointerExceptions at compile time using static analysis tools, significantly improving interoperability with Kotlin.

Starter packages have also been refined. Starters have been modularized according to their purpose, such as spring-boot-starter-webmvc to reduce unnecessary dependencies when building web environments. This release also includes @ImportHttpServices for registering declarative HTTP clients and native support for Jackson 3.

When to Migrate and What to Prepare

If you are starting a new project, Spring Boot 4 is a compelling choice. Since the base Java version is 17 or higher, teams already using the latest LTS runtime can immediately take advantage of native versioning and the streamlined starter configuration.

On the other hand, if you have existing projects stuck on Spring Boot 2.x or Java 11 or below, there is no need to rush. Because Jakarta EE 11 migration and package namespace checks are required, we recommend first verifying the compatibility of internal company libraries and establishing a gradual upgrade plan.

Loading comments…