Today is an exciting day for all Spring Boot developers as Spring Boot 3.2 packed with new and enhanced features was released! The highlights of this release include but are not limited to
- JVM Coordinated Restore at Checkpoint (CRaC),
- support for Virtual threads,
- support for Java 21 LTS,
- enhanced AppCDS support.
Let’s dive into the new functionality in more detail and see how it will empower your Spring Boot applications.
Table of Contents
CRaC support
Coordinated Restore at Checkpoint (CRaC) is a JVM API that enables the developers to create an image of a running Java application,and then restore the application from the file at the exact state when the checkpoint was made. This way, the startup and warmup times reduce from seconds to milliseconds without any performance losses!
CRaC is a promising functionality in terms of lowering cloud costs by minimizing the time you pay for resource usage and optimizing the instance size.
With this release, Spring Boot integrates with CRaC seamlessly, enabling you to use the feature out-of-the-box. Prerequisites to utilizing CRaC with Spring:
- JVM with CRaC support,
- The
org.crac:crac
library version 1.4.0 or higher, - The java command line parameters (such as
-XX:CRaCCheckpointTo=PATH
or-XX:CRaCRestoreFrom=PATH
) specification.
BellSoft provides a special build of Liberica JDK, the default runtime for Spring, with CRaC so that Spring Boot users can enjoy an all-round experience with Coordinated Restore at Checkpoint when developing and deploying their projects. Find out how to use CRaC with the new Spring Boot and Liberica JDK here.
Enhanced AppCDS preparing the grounds for Project Leyden
Application Class Data Sharing (AppCDS) is a JVM feature that enables developers to cut down the startup time and memory footprint of Java applications. With AppCDS, the JVM can create pre-processed archives of classes loaded at startup, and then share them between JVM instances on the same host. As a result, there’s no need to parse and verify the classes at each startup and duplicate them in memory.
The Spring Framework 6.1 and consequently, Spring Boot 3.2 offer an enhanced support for AppCDS, enabling the developers to use this functionality in a more convenient way.
Java 21 LTS
JDK 21 is the latest Java LTS release, and as any LTS version intended for long-term enterprise use, it is full of major enhancements and novelties. 15 JEPs in total are aimed at improving the performance (virtual threads, generational ZGC, etc.), convenience (e.g., unnamed pattern and variables), and security (the key encapsulation mechanism API) of the Java platform. If you wish to learn more about all JDK 21 features, refer to our previous article.
While Spring Boot 3.2 maintains JDK 17 as a baseline, it is fully compatible with Java 21.
Virtual threads (Project Loom)
Virtual threads in the novel JDK feature developed under the auspices of Project Loom. It was first introduced in JDK 19 and finalized in JDK 21. Virtual threads bring the development of concurrent high-throughput Java applications to the next level because they enable developers to create thousands of lightweight threads, which can be managed, monitored, and debugged just like the usual threads.
Spring Boot 3.2 provides full support for virtual threads together with many additional configuration options aimed at making the process of working with this feature more convenient and reliable. To use virtual threads with the new Spring Boot, developers need to use JDK 21 and set the spring.threads.virtual.enabled
property to true.
Boost your Java project with new Spring Boot and Alpaquita Containers!
More on Spring Boot 3.2 features and enhancements you can find in the Release Notes. The more efficient development couples nicely with efficient deployment when using Alpaquita Containers tailor-made for Spring Boot apps. Based on a lightweight Alpaquita Linux and Liberica JDK, these containers enable the developers to save up to 30 % of RAM and help to secure the project thanks to additional security hardening and regular updates both for JDK and Linux. Try the new Spring Boot with Alpaquita Containers and tell us what you think!