Software Development

Spring Framework 6.0 and Spring Boot 3.0 – Upcoming Changes Overview

Home

>

Blog

>

Software Development

>

Spring Framework 6.0 and Spring Boot 3.0 – Upcoming Changes Overview

Published: 2022/10/06

Updated 17/11/2023

7 min read

With a General Availability release date scheduled for October 2022, it is a tantalizing idea to use Spring Framework 6.0 with or without Spring Boot 3.0 in your new project, or migrate an existing one from the currently used version. As declared by the Spring project team, the new version of the framework intends to introduce changes that will make it “future-proof at the price of initial compatibility breakage.”  

The releases will be of much interest in the Java development circles. According to 2021 Spring Framework User Survey, 86% of participating Java developers use Spring Framework or Spring Boot. So take a look at the most important changes announced so far and see how they’ll affect projects based on Spring Framework 6.0 and Spring Boot 3.0. 

What’s new in Spring Framework 6.0? 

JDK 17 and Jakarta EE 9 baseline

The Spring project team plans to significantly change the baseline Java version – this will set the minimum required version of JDK to a runtime of 17 and necessitate the usage of Jakarta EE 9 compatible web server (such as Tomcat 10 or Jetty 11). This, of course, means a serious upgrade for some of the older projects.  

The release of Jakarta EE 9 is a final step in a larger plan of transferring Java EE from Oracle to open-source Eclipse Foundation, which required changing the API package name from javax namespace to jakarta. This will affect packages such as Servlet API, JPA, Bean Validation and many others, and necessitate adjustments in import statements. As specified in the guidelines on upgrading to 6.0, some of the affected classes are annotations, such as @Inject (switch from javax.inject to jakarta.inject), @PostConstruct or @PreDestroy (switch from javax.annotation to jakarta.annotation). Another requirement stated in the guidelines is updating Hibernate ORM to 5.6.x version, which in turn makes it necessary to switch javax.persistence imports to jakarta.persistence. 


Download White paper: Hardware-in-the-loop Testing Is Key to High-quality Embedded Systems

Miscellaneous changes in Spring 6.0 

The aforementioned source code changes are only the more noticeable ones and many minor changes and fixes might appear depending on a particular application. But the bottom line is: introducing jakarta namespace necessitates making changes in import statements, replacing deprecated classes and updating third-party libraries to compatible types.  

Another set of changes is connected to dropping out integration with several outdated Servlet-based solutions, such as Commons FileUpload or FreeMarker JSP, which might require a significant rework of web applications that rely on them. Moreover, the Spring-specific class ListenableFuture will be deprecated in favor of CompleteableFuture provided by core Java.  

Spring Framework 6.0 will introduce a change in controller detection for Spring MVC and Spring WebFlux. In previous versions, a class annotated only with a top-level @RequestMapping annotation was registered as handler, even without @Controller or @RestController annotation. With Spring Framework 6, @Controller annotation is required.

Read more: What is enterprise app development

Spring Native 

Spring Native  provides support for compiling Spring applications to native images with GraalVM, thus providing a new way to deploy Spring applications.  

Spring Framework 6.0 aims at providing core support for Spring Native – the first features will be introduced to the third milestone of Spring Framework 6.0 with more coming in in the future. If you would like to learn more about Spring Native, check out this detailed video provided by the Spring project team. 

Spring Boot 3.0 – what you need to know 

Changes in properties processing 

Spring Boot 2.4 introduced changes in application properties processing – a change that might have been not noticeable for most projects, but in some cases, it was necessary to rely on previous behavior, which can be activated using spring.config.use-legacy-processing property. 

In Spring Boot 3.0 legacy properties processing will no longer be supported, therefore projects that use old behavior have to ensure that new properties processing is compatible. 

Actuator Metrics 

Two important changes will affect Actuator metrics:  

Removed auto-configuration for embedded MongoDB 

Spring Boot 3.0 will no longer support auto-configuration and dependency management for Flapdoodle embedded MongoDB. Projects that use a Flapdoodle should use an auto-configuration library provided by this project or consider migrating to Testcontainers 

Matching trailing slash in URLs deprecated 

Currently, an endpoint registered in controller matches by default the defined path with trailing slash – for example, @GetMapping(“/some/greeting”) will match both /some/greeting and /some/greeting/ paths. In Spring Boot 3 this will no longer be supported by default due to security concerns. The previous behavior can be activated with appropriate configuration, although it is recommended to adjust the web application to use the new approach. 

Spring Framework 6 and Spring Boot 3 – Conclusion 

The releases of Spring Framework 6 and Spring Boot 3 are mainly aimed at keeping projects up to date with the current state of Java ecosystems, mainly the release of Jakarta EE 9 and the transfer of this project from Oracle to Eclipse Foundation. While this is a core point of this release, it also brings changes that might affect certain existing projects, and introduces new parts of Spring ecosystem to a broader audience (Spring Native). All in all, the main goal is to brush up the foundations of the framework and provide access to the latest Java baseline, which is certainly peaking users’ curiosities. 

Keeping up with new framework releases is a crucial element of maintaining software. For a product to be both successful and secure, engineers need to keep their finger on the pulse of new developments in their technologies of choice. At Software Mind, we stay on top of cutting-edge solutions to help industry leaders gain a competitive edge. If you’re looking for a software development team that will reliably support you with their tech expertise, contact us by filling out this form.

FAQ section

What is Spring Framework 6?

Spring Framework 6, released in November 2022, is the latest version of the popular Spring Framework. The Spring Framework is designed to keep up with current and future innovations in the Java ecosystem. The latest version is easy to upgrade from Spring Framework 5.3.x and can be used in modern-day runtime environments. The framework provides a comprehensive programming and configuration model for developing Java-based enterprise applications you can deploy on any platform. It offers infrastructural support at the application level by taking care of enterprise application plumbing so that teams can focus on application-level business logic without being tied to specific deployment environments. The framework comes with core technologies such as dependency injection, events, resources, i18n, validation, data binding, type conversion, (Spring Expression Language) SpEL and Aspect-oriented programming, testing, data access, web frameworks, integration and language support.

What are the advantages of migrating to Spring Framework 6.0 for my business?

Migrating to Spring Framework 6.0 offers several advantages for businesses, including enhanced performance, improved reactive programming support, simplified dependency injection and strengthened security features. Additionally, it reduces development costs, boosts developer productivity and grants access to a vast ecosystem of libraries and tools. To determine if migration is suitable, evaluate your current application architecture, identify areas that benefit from the new features and assess the migration’s costs and time requirements. Migrating to Spring Framework 6.0 can assist your business in staying current with the latest Java technologies and security compliance, which will improve the performance, safety and scalability of your enterprise applications.

What is the main difference between Spring and Spring Boot?

The important difference between Spring and Spring Boot is that Spring is a comprehensive infrastructure support framework for developing Java applications. It provides a programming and configuration model for modern Java-based enterprise applications on any deployment platform. On the other hand, Spring Boot is an extension of the Spring framework that eliminates the boilerplate configurations required for setting up a Spring application. Spring Boot takes an opinionated view of the Spring platform, which paves the way for a faster and more efficient development ecosystem. It includes several features such as opinionated ‘starter’ dependencies, an embedded server, metrics, health check and externalized configuration. In summary, while Spring provides a comprehensive infrastructure support framework, Spring Boot provides a faster and more efficient development ecosystem by eliminating boilerplate configurations and taking an opinionated view of the Spring platform.

How can Spring Framework 6.0 improve my existing Java applications?

Upgrading your current Java applications to Spring Framework 6.0 can bring significant improvements. Firstly, it introduces a baseline of Java 17+ and adopts Jakarta EE 9+, which ensures compatibility with the latest Java ecosystem advancements. Additionally, it offers improved support for reactive programming and allows for asynchronous and non-blocking operations, which can lead to more efficient and scalable applications. Moreover, Spring Framework 6.0 enhances web application development with better integration of Servlet 6.0 and JPA 3.1. Spring Framework 6.0 has also introduced new features, such as the Spring WebFlux reactive web framework, which provides a streamlined approach to building reactive web applications. In conclusion, upgrading to Spring Framework 6.0 can modernize your existing Java applications, boost their performance and simplify their development and maintenance.

About the authorKrzysztof Honkisz

Senior Software Engineer

A Software Engineer with 6 years' experience, Krzysztof has worked in backend and frontend software development. Over his career he's taken part in various projects, ranging from backend services built with pure Java and Spring/Spring Boot frameworks to frontend applications created with React and React Native libraries. An active member of Software Mind's Frontend and Java Guilds, he is a cyclist and avid bookworm in his free time.

Subscribe to our newsletter

Sign up for our newsletter

Most popular posts

Privacy policyTerms and Conditions

Copyright © 2024 by Software Mind. All rights reserved.