Spring Boot 4 and Spring Framework 7: Key Features and Changes

23 Aug 2025
8 mins read

placeholder

Spring Boot 4 is coming in November 2025 (Milestones versions already available), built on top of the brand new Spring Framework 7.0.0.
If you develop modern Java applications, this release brings a host of updates and new features worth exploring.

After the big migration in Spring Boot 3.x to Jakarta EE 10, Spring Boot 4 continues the modernization journey with stronger alignment to Jakarta EE 11, modern JDKs, and cloud-native development practices. This is a major milestone that sets the tone for the next decade of Java development.

In this article, we’ll highlight the most important changes and what they mean for your projects.

Spring Boot 4 Platform Updates

1. Java and JVM Support

2. Jakarta EE 11 Alignment

3. Kotlin 2.2 Support

4. Cloud-Native and Containerization

5. Productivity & Developer Experience

6. Security

7. Future-Proofing with Spring AI & Native APIs

Spring Framework 7 Features

1. Elegant API Versioning

Spring Framework 7 now supports API versioning directly in the @RequestMapping annotation, making it easier to maintain multiple versions of your REST endpoints and ensure backward compatibility.

@RestController
@RequestMapping("/api/products")
public class ProductController {

    @RequestMapping(value = "/search", version = "1")
    public List<ProductV1> searchProductsV1(@RequestParam String query) { ... }

    @RequestMapping(value = "/search", version = "2")
    public ProductSearchResponseV2 searchProductsV2(@RequestParam String query,
                                                    @RequestParam(defaultValue = "10") int limit) { ... }
}

You can specify the desired version using the Version header in your HTTP request. The controller will route the request to the appropriate method based on the version provided.

To call version 1 of the API (returns simple product list):

GET /api/products/search?query=laptop
Version: 1

To call version 2 of the API (returns enhanced search with metadata):

GET /api/products/search?query=laptop&limit=20
Version: 2

2. Null Safety with JSpecify

Spring Framework 7 has migrated to JSpecify annotations, improving null safety and integration with Kotlin. JSpecify provides more precise nullness contracts for method parameters, return types, and fields, helping developers catch potential null-related bugs at compile time.

Here’s how you might use JSpecify annotations in a Spring component:

import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NonNull;

@Component
public class UserService {
    public @NonNull String getUserName(@Nullable String userId) {
        if (userId == null) {
            return "Unknown";
        }
        // fetch user name logic
        return "Alice";
    }
}

In this example, the userId parameter can be null, but the method guarantees a non-null return value. This helps prevent null pointer exceptions and improves code reliability, especially when integrating with Kotlin or other null-safe languages.

3. Programmatic Bean Registration with BeanRegistrar

Spring Framework 7 introduces the BeanRegistrar contract, allowing developers to register beans programmatically with more flexibility. This is useful for advanced scenarios where multiple beans need to be registered dynamically, beyond what is possible with @Bean methods.

@Configuration(proxyBeanMethods = false)
public class MyBeanConfig implements BeanRegistrar {
    @Override
    public void registerBeans(BeanDefinitionRegistry registry) {
        registry.registerBeanDefinition("myBean", new RootBeanDefinition(MyBean.class));
    }
}

You can register beans based on runtime conditions or external configuration, making your application more dynamic and modular.

4. Improved Support for Optional in SpEL Expressions

SpEL (Spring Expression Language) now has better support for Optional types, including null-safe operations and the Elvis operator. This makes it easier to work with optional values in configuration and bean definitions.

@Value("#{userService.findUser(#userId)?.orElse('Guest')}")
private String userName;

You can safely handle missing values and avoid null pointer exceptions in your configuration and bean wiring.

5. Resilience Features: @Retryable, @ConcurrencyLimit, @EnableResilientMethods

New annotations like @Retryable and @ConcurrencyLimit help build more resilient applications by enabling retry logic and concurrency limits directly in your service methods. The @EnableResilientMethods annotation activates these features for your beans.

@Service
@EnableResilientMethods
public class PaymentService {
    @Retryable(maxAttempts = 3)
    public void processPayment() {
        // logic that may fail and should be retried
    }

    @ConcurrencyLimit(maxConcurrentCalls = 5)
    public void updateBalance() {
        // logic with concurrency limit
    }
}

You can add retry and concurrency control to your business logic with simple annotations, improving reliability and scalability.

6. Dedicated Configuration for HTTP Clients with @ImportHttpServices

Spring Framework 7 adds the @ImportHttpServices annotation, making it easier to configure and group HTTP clients. This streamlines the setup for applications that interact with multiple external services.

@Configuration(proxyBeanMethods = false)
@ImportHttpServices(group = "weather", types = {WeatherClient.class})
public class HttpClientConfig {}

You can organize and configure multiple HTTP clients efficiently, reducing boilerplate and improving maintainability.

7. Streaming Support with InputStream and OutputStream in HTTP Clients

HTTP clients now support streaming request and response bodies using InputStream and OutputStream. This is especially useful for handling large files or data streams efficiently.

@PostMapping("/upload")
public void uploadFile(InputStream inputStream) {
    // process large file stream
}

You can handle large file uploads and downloads without loading everything into memory, improving performance and scalability.

8. New JmsClient and Enhancements to JdbcClient

The new JmsClient provides a modern API for working with JMS (Java Message Service), while JdbcClient has been enhanced for easier and more flexible database operations.

JmsClient jmsClient = JmsClient.create(connectionFactory);
jmsClient.send("queue", "Hello World");

JdbcClient jdbcClient = JdbcClient.create(dataSource);
List<User> users = jdbcClient.sql("SELECT * FROM users").query(User.class).list();

You get a more fluent and modern API for messaging and database access, reducing boilerplate and improving developer productivity.

9. Centralized Configuration for HTTP Message Converters

Spring Framework 7 introduces centralized configuration for HTTP message converters, making it easier to customize how data is serialized and deserialized in web applications.

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void configureMessageConverters(HttpMessageConverters.ServerBuilder builder) {
        builder.jsonMessageConverter(new JacksonJsonHttpMessageConverter(JsonMapper.builder().build()));
    }
}

You can easily customize serialization and deserialization logic for your APIs in a single place, improving consistency and maintainability.

10. New RestTestClient for REST API Testing

RestTestClient is a new tool for testing REST APIs, offering a fluent API and support for both live servers and mock setups. It simplifies writing and maintaining integration tests for your endpoints.

RestTestClient client = RestTestClient.bindToServer("http://localhost:8080");
client.get().uri("/api/user").exchange().expectStatus().isOk();

You can write concise and readable integration tests for your REST endpoints, improving test coverage and reliability.

11. Enhanced Path Matching with Improved PathPattern Support

Path matching in Spring MVC has been improved with the enhanced PathPattern support, replacing legacy options and providing more powerful and flexible URI template matching for your controllers.

@RequestMapping("/**/pages/{pageName}")
public String handlePage(@PathVariable String pageName) {
    return pageName;
}

You can define more flexible and powerful URI patterns for your controllers, making routing and endpoint design easier and more expressive.

12. API Removals and Deprecations

Spring Boot 4 and Spring Framework 7 have removed several legacy features and deprecated APIs to streamline the framework and encourage modern development practices.

Removed / DeprecatedAlternative
spring-jclApache Commons Logging
javax.annotation, javax.injectjakarta.annotation, jakarta.inject
suffixPatternMatch, trailingSlashMatch, favorPathExtensionExplicit media types / URI templates
XML-based Spring MVC configJava-based WebMvcConfigurer
JUnit 4JUnit 5
Jackson 2.xJackson 3.x

Below you can find more details about each removal and deprecation.

Module Changes

The spring-jcl module has been retired in favor of Apache Commons Logging, simplifying the logging infrastructure. Additionally, annotations from javax.annotation and javax.inject are no longer supported—you’ll need to migrate to their Jakarta equivalents: jakarta.annotation and jakarta.inject.

Path Mapping Simplification

Several path mapping options have been removed from Spring MVC. Features like suffixPatternMatch, trailingSlashMatch, and favorPathExtension are no longer supported in annotated controller methods and content negotiation.

Previously, you could use suffix-based routing:

@RequestMapping(value = "/users.json", produces = "application/json")
public List<User> getUsersJson() { ... }

Or configure suffix pattern matching in Java config:

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setUseSuffixPatternMatch(true);
    }
}

These options are now removed. Instead, use explicit media types and URI templates for cleaner, more predictable routing.

XML Configuration Deprecation

XML configuration for Spring MVC is now deprecated. If you’re still using XML-based configuration like this:

<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/public/" />
<mvc:view-controller path="/home" view-name="home" />

It’s recommended to migrate to Java-based configuration:

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/home").setViewName("home");
    }
}

Testing and Serialization Updates

Support for JUnit 4 and Jackson 2.x is also deprecated, encouraging migration to JUnit 5 and newer Jackson versions for better performance and modern testing capabilities.

Migration Checklist

Java 17+, package updates, XML configs, Junit 5 are some changes you can start now, to make sure your project is ready and simplify the migration process.

Final Thoughts

Spring Boot 4 and Spring Framework 7 mark a major step forward for Java development, bringing more security, flexibility, and features for modern applications. If you’re considering upgrading your project, I recommend reviewing the changes carefully and testing thoroughly before moving to production. Current Spring Boot 3.5.x will have OSS support until June 2026, so plan accordingly!

Happy Coding!

References