BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Spring Boot 3 and Spring Framework 6 Use Java 17 and Jakarta EE 9, Support Native Java with GraalVM

Spring Boot 3 and Spring Framework 6 Use Java 17 and Jakarta EE 9, Support Native Java with GraalVM

VMware released the long-anticipated Spring Framework 6 and Spring Boot 3. After five years of Spring Framework 5, these releases start a new generation for the Spring ecosystem. Spring Framework 6 requires Java 17 and Jakarta EE 9 and is compatible with the recently released Jakarta EE 10. It also embeds observability through Micrometer with tracing and metrics. Spring Boot 3 requires Spring Framework 6. It has built-in support for creating native executables through static Ahead-of-Time (AOT) compilation with GraalVM Native Image.

Michael Minella, senior director of software engineering at VMware, told InfoQ:

Spring has taken the approach of enabling Spring developers to build on their existing expertise to achieve the benefits of native compilation without significant changes, something unique in the ecosystem.

VMware announced Spring Framework 6 and Spring Boot 3 at its SpringOne 2021 conference. For the first time since 2010, a Spring Framework update followed not one, but two years after the previous major release - version 5.3 in 2020. In a recent interview, Josh Long, Java Champion and Spring Developer Advocate at VMware, discussing the extended development time for Spring Framework 6, stated:

"The migration to Jakarta EE has been challenging for us as framework developers", "the work for observability has also been widespread", and "the work for Ahead-of-Time (AOT) compilation with GraalVM Native Image [...] has been in the works in some form or another since at least 2019".

For more insights into the making of these two releases, please see the related interview with Josh Long.

Supporting Jakarta EE 10 makes Spring Framework 6 compatible with the latest web servers, such as Tomcat 10.1, Jetty 11, and Undertow 2.3. Spring Framework 6 also simplifies HTTP requests by defining them in so-called HTTP interfaces, like Spring Data JPA simplifies database queries through repository interfaces. HTTP error messages are now more helpful with RFC 7807 problem details.

As a preview feature, Spring Framework 6 can use the virtual threads from Project Loom on Java 19. Virtual threads and the associated structured concurrency API simplify concurrent programming in Java and make it more efficient to run. Unlike Oracle, Spring sees virtual threads complementing reactive programming, not replacing it.

Notable dependency upgrades in Spring Framework 6 include Kotlin 1.7, Hibernate ORM 6.1, Jackson 2.14 for JSON and XML parsing, and R2DBC 1.0 for reactive database access.

As InfoQ reported last year, support for the Java Platform Module System (JPMS) in Spring Framework 6 was originally planned but never came to fruition. However, the decision was made to delay support for JPMS:

Spring Framework 6.0 strongly focuses on AOT and GraalVM native images for optimizing the deployment arrangement of Spring-based applications. [...] There have been very few requests for it [module support] in the course of this year. [...] Deeper module system alignment remains part of our long-term technology strategy for the Spring Framework 6.x generation.

The OpenJDK Project Leyden plans to optimize Java and relies on JPMS and the jlink linking tool. Without JPMS support, Spring applications couldn't use these optimizations.

The highlight of Spring Boot 3 is support for producing native executables. These executables start faster, use less memory, have smaller container images, and are more secure. That makes Java more competitive in the cloud. The frameworks Quarkus, Micronaut, and Helidon made native executables popular in Java. InfoQ recently published a six-piece article series on this topic. When the GraalVM Native Image compiler is installed on a developer's machine, creating a native executable with Spring Boot 3 is as simple as ./mvnw -Pnative package or ./gradlew nativeCompile. More details may be found in this blog post.

Jakarta EE 9 changed the Java namespace from javax.* to jakarta.*. This requires changes to existing Spring and Spring Boot applications if they import Jakarta EE types like annotations, validations, or JPA. That's why the recently introduced Spring Boot Migrator project is "working on [an] automated upgrade from Spring Boot 2.7 to Spring Boot 3.0."

VMware shortened the commercial and open-source support duration for Spring Framework 6. As Juergen Hoeller, Spring Framework project lead at VMware, put it: 

The expectation is that people upgrade to the latest 6.x feature releases more quickly.

In contrast, the free support duration for Spring Boot 3.0 remains at one year.

VMware will discuss its new releases at its virtual SpringOne conference from January 24-26, 2023, that was originally planned as an on-site conference for December 2022.

About the Author

Rate this Article

Adoption
Style

BT