I was recently impressed by Spring Boot's native images feature. I considered sharing some information about native images.
I created two simple Spring Boot projects
1) spring-with-native-plugin
2) spring-without-native-plugin
Apart from the Main class, I used the same controller in both projects.
I used the following command to create docker images.
mvn spring-boot:build-image
(Both projects are based on maven)
When I ran both docker images, I was surprised by the application startup time.
There's also a significant difference in the sizes of the two Docker images.
So, What happened after we installed the native plugin?
- Thanks to Spring AOT Process, it performed a code analysis to identify unnecessary code.
- After the code analysis, all unnecessary code was removed, and a native image was created.
Now, This native image is no longer dependent on the JVM and can run without the JVM.
We must thank @graalvmfor making this all possible.
Top comments (0)