What’s New in Spring Framework 7? Features, Removals, and Migration Tips

Spring Framework 7 introduces a new baseline on JDK 17/25, upgrades to Jakarta EE 11, Kotlin 2.2 and GraalVM 25, removes several legacy APIs such as spring‑jcl and javax.annotation, deprecates features like RestTemplate and XML MVC config, and adds powerful capabilities including programmatic bean registration, enhanced HTTP client support, and improved testing extensions.

Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
What’s New in Spring Framework 7? Features, Removals, and Migration Tips

1. Introduction

Spring Framework 7 arrives with many long‑awaited features and carefully crafted improvements that modernise the framework while reducing boilerplate in everyday development.

2. New Features

2.1 Baseline Upgrade

The new baseline retains JDK 17 and recommends JDK 25 as the latest LTS version. It also adopts Jakarta EE 11, Kotlin 2.2 and GraalVM 25.

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/9.1)

GraalVM 25 with the new “precise reachability metadata” format

Netty 4.2 (see #34996)

Kotlin 2.2 (see #33629)

JUnit 6

2.2 Removed APIs

Removal of spring-jcl in favour of Apache Commons Logging 1.3.0.

Removal of support for javax.annotation and javax.inject annotations; migrate to jakarta.annotation and jakarta.inject.

Removal of several path‑mapping options such as suffixPatternMatch, trailingSlashMatch, and related content‑negotiation flags.

Removal of Undertow support because Undertow does not yet support Servlet 6.1.

Other removals include ListenableFuture (replaced by CompletableFuture), WebJars‑locator‑core, OkHttp3 support, and various internal APIs (see issue numbers in the original text).

2.3 Major Changes

The SpringExtension now scopes the ExtensionContext to the test method, enabling consistent dependency‑injection semantics for @Nested test classes. Custom TestExecutionListener implementations may need to use testContext.getTestInstance().getClass() instead of testContext.getTestClass().

Deprecated items include RestTemplate (will be officially deprecated in 7.1) and the <mvc:*> XML namespace (still usable but no longer updated).

2.4 Powerful New Additions

Full‑stack null‑safety using JSpecify annotations, replacing the older JSR‑305 approach.

Support for Java 24+ class‑file APIs via a new ClassFileMetadataReader in spring‑core.

Programmatic bean registration through the BeanRegistrar contract.

Enhanced SpEL support for java.util.Optional and Elvis operator handling.

Global proxy type default switched to CGLIB with opt‑out via the @Proxyable annotation.

Resilient retry support merged into org.springframework.core.retry with RetryTemplate, @Retryable and @ConcurrencyLimit.

New HTTP client configuration via @ImportHttpServices and a dedicated RestTestClient for non‑reactive testing.

PathPattern matching now uses the new matcher; the old AntPathMatcher is deprecated.

3. Sample Configurations

@Configuration(proxyBeanMethods = false)
@ImportHttpServices(group = "weather", types = {FreeWeather.class, CommercialWeather.class})
@ImportHttpServices(group = "user", types = {UserServiceInternal.class, UserServiceOfficial.class})
static class HttpServicesConfiguration extends AbstractHttpServiceRegistrar {
    @Bean
    public RestClientHttpServiceGroupConfigurer groupConfigurer() {
        return groups -> groups.filterByName("weather", "user")
            .configureClient((group, builder) -> builder.defaultHeader("User-Agent", "My-Application"));
    }
}
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
    @Override
    public void configureMessageConverters(HttpMessageConverters.ServerBuilder builder) {
        JsonMapper jsonMapper = JsonMapper.builder()
            .findAndAddModules()
            .enable(SerializationFeature.INDENT_OUTPUT)
            .defaultDateFormat(new SimpleDateFormat("yyyy-MM-dd"))
            .build();
        builder.jsonMessageConverter(new JacksonJsonHttpMessageConverter(jsonMapper));
    }
}

4. Conclusion

Spring Framework 7 modernises the stack, raises baseline requirements, removes outdated APIs, deprecates legacy features, and introduces a suite of powerful new capabilities that simplify bean registration, improve null‑safety, enhance HTTP client handling, and provide a more consistent testing experience. Migrating applications should review the removed APIs, update deprecated annotations, and consider the new configuration options to fully benefit from the upgrade.

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.

JavaMigrationBackend DevelopmentSpring Bootapi-changesSpring Framework
Spring Full-Stack Practical Cases
Written by

Spring Full-Stack Practical Cases

Full-stack Java development with Vue 2/3 front-end suite; hands-on examples and source code analysis for Spring, Spring Boot 2/3, and Spring Cloud.

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.