.app-desktop{ --postPageVerticalPadding: 0px !important; }
top of page
Search

What's New in Spring 6 and Spring Boot 3?

Updated: Feb 13, 2023



Since the early 2000s, I’ve been working with Java and Spring. While most of my experience is with backend development, my full-stack development experience is with Angular, my preferred front-end framework. I’m currently assigned to the Amway account working on a dedicated scrum team that develops in Java, Spring, and Spring Boot.

Spring 6 and Spring Boot 3 are the latest versions of the popular Java framework for building web applications. Both versions bring new features and improvements to the framework, making it easier for developers to build and deploy their applications.

This blog will cover the main features introduced in Spring 6 and Spring Boot 3, which includes Java 17 being the new baseline version.

Spring 6

One of the major new features in Spring 6 is support for Java 17. This means that developers can now use the latest version of Java to build their Spring applications, which can bring performance and security improvements. Spring 6 also includes support for the latest versions of other popular Java libraries, such as Hibernate and Jackson. Additional enhancements include:

  • Upgraded baseline Java version to Java 17. Java 17 is the latest LTS (Long-term Supported) version with all the new features introduced in recent Java versions such as records, instanceof changes, and multiline strings

  • Replaced Java EE with Jakarta EE; the minimum supported version is Jakarta EE9. This breaks backward compatibility and is the source of most issues in the migration process. It will use the jakarta packages namespace instead of Javax (Java Extension) namespace

  • Enhanced support for native compilation, a move towards making cloud-native applications more efficient. It is in response to newer frameworks such as Quarkus and Micronaut that produce native applications with low memory usage and fast start-up times

  • Bakes observability into Spring to further encourage cloud-native development. Unlike agent-based observability, it records metrics with Micrometer and offers tracing through providers such as OpenZipkin or OpenTelemetry

  • Native support for declarative HTTP client interface using @HttpExchange annotations

  • Drops several outdated features and third-party integrations

Spring Boot 3

Spring Boot 3, on the other hand, brings new features for building and deploying Spring applications. Spring boot 3 will use Spring 6, so all the above changes automatically apply to Spring boot 3 applications as well, plus a few more:

  • SB 3 will also have out-of-the-box support for Native Java compilation for GraalVM

  • A big change is that Spring Boot 3 will remove all deprecated features. For example, in Spring boot 2.4, configuration properties processing had changed in incompatible ways and to fix it, the use of spring.config.use-legacy-processing=true was suggested. So make sure this property is not in your code

Upgrading

  • The Spring Boot Migrator (SBM) can be helpful in migrating a Spring Boot

  • Upgrade Java version. As Java 17 is the new baseline in new Spring versions, start with migrating your applications to Java 17 first with your current Spring versions and existing codebase

  • Fix import statements. This change will require you to rename all javax.* imports to jakarta.* imports

Conclusion

The enhanced support for native compilation alone is a big reason for migrating to the newer versions of Spring and SpringBoot. It also makes an application more mature and cuts the tie to older versions of Java runtime, mainly Java 8 and 11, reducing technical debt.

One suggestion is to do a technical spike in a branch to identify what issues may arise, and whether or not you need to do some other migrations and/or refactoring efforts first. For example, a spike I did recently for one of our client’s applications identified changes needed related to newer versions of 3rd-party libraries that Spring 6 and Spring Boot 3 rely on (ex: H2 embedded database).


Written by Darrin Rogers, Senior Software Engineer


137 views0 comments
bottom of page