Spring Boot 3.0 Goes GA
by aaronchenwei
Spring Blog announced that Spring Boot 3.0 is now generally available and 3.0.0 can be found in Maven Central on November 24, 2022.
1. Highlights of the new release include:
- A Java 17 baseline
- Support for generating native images with GraalVM, superseding the experimental Spring Native project
- Improved observability with Micrometer and Micrometer Tracing
- Support for Jakarta EE 10 with an EE 9 baseline
2. Migrate to Spring Boot 3.0
We could follow the official Migration Guide.
Please read this guide carefully, especially for the Spring features that are used in your applications.
3. What is New?
3.1. Java 17
Java 17 brings lots of new language features and JVM features. You refer my blog
4. Jakarta EE 9
The most important change might be the jump from Java EE to Jakarta EE9, where the package namespace changed from javax.* to jakarta.*. As a result, we need to adjust all imports in our code whenever we use classes from Java EE directly.
For example, when we access the HttpServletRequest object within our Spring MVC Controller, we need to replace:
import javax.servlet.http.HttpServletRequest;
with
import jakarta.servlet.http.HttpServletRequest;
5. Native Executables
Building native executables and deploying them to GraalVM gets a higher priority. So the Spring Native initiative is moving into Spring proper.
For AOT generation, there’s no need to include separate plugins, we can just use a new goal of the spring-boot-maven-plugin:
$ mvn spring-boot:aot-generate
The native application can be built as follows:
$ mvn spring-boot:build-image
# or
$ gradle bootBuildImage