As technologies evolve, development should also evolve to keep pace and ensure security is maintained. Spring Boot 3.0 was launched recently and we decided to give it a try. In this article, we explore briefly the new Spring Boot 3.0 and explain what has changed and how it affects you.
As always, Java Development Kit (JDK) is required to run every java application. The new spring boot comes with a baseline version, a minimum version required to run spring boot version 3.0. Spring boot 3.0 requires JDK version 17 installed on the client machine. JDK version 17
Support for GraalVM Base and Native Build Tools
The increasing demand for native-based development and compilation is not left out in Spring Boot 3.0 as it has been taken care of. GraalVM Native Image is a technology developed to compile Java code ahead of time to a binary – a native executable. Recall that, a native executable will include only code required at run time, such as application classes, standard-library classes, the language runtime, and statically-linked native code from the JDK.
Furthermore, GraalVM Native images provide a new way to deploy and run Java applications. If we compare this to the more traditional Java Virtual Machine, native images have the capacity to run with a smaller memory footprint, thus giving us speed and improved startup time.
Support for third-party libraries
As this is a major version introduction, support for libraries used in previous versions was improved. As always, Spring Framework 6 is highly recommended and supported as well as a host of other libraries that were upgraded. Some of the upgraded Libraries include:
1. Spring Batch 5.0: a framework that provides batch processing of records ability.
2. Spring Kafta 3.0: a fault tolerant-messaging project.
3. Spring Session 3.0: a tool for managing HTTP sessions.
Other libraries can be found in the Spring Boot 3.0 release note.
Migration from Java EE to Jakarta EE
A major shift in this release is the movement from Java EE to Jakarta EE. This implies that where javax.* is used, will become jakarta.*
A sample import header is shown in the code below:
For Java EE: import javax.persistence.entity For Jakarta EE: import jakarta.persistence.entity
Support for Micrometer Observation API
Support for the new observation APIs introduced in Micrometer 1.10 was not left out in this major version. Auto configuration capability is now available for the ObservationRegistry interface. In Micrometer Observation API, Zipkin and Wavefront are now completely supported. While Zipkin configuration can be done in management.zipkin.tracing, Wavefront configuration file is found in management.wavefront. Importantly, tracing is handled by management.tracing. Observation API provides a way for Observability (a feature that observes internal states) to observe and understand internal activities of systems in execution from an outside point.
The quest for solutions that can serve our modern-day development is on, and Spring Boot 3.0 has provided support to achieve flexibility, improve security, and support for libraries. In this article, we explored the new Spring Boot 3.0 and provided insight into some of the new features. As always, we developed a simple Hello world application using Spring Boot 3.0. Tutorial code can be found on our GitHub page.