Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Spring Applications to GraalVM Native Images

Tags:

The GraalVM system apparently cannot compile a Spring application into a native image.

Can we compile a subset of the Spring application -- say, as a separate library -- and then use that with the remainder compiled using the usual javac compiler?

Or maybe if we leave out some Spring features from our application?

Any other possibilities?

like image 916
Alok P Avatar asked Jun 18 '18 14:06

Alok P


1 Answers

A probably more up-to-date answer to this question is provided by the release of Spring Native beta that we (the Spring team) have just announced with a very detailed blog post and a video.

It allows you to compile Spring applications to a native executable with GraalVM native-image compiler via Spring Boot mvn spring-boot:build-image or gradle bootBuildImage commands, or by just leverage a local native-image installation via the native-image-maven-plugin.

A Spring Boot application compiled as a native image starting in 38 ms

The most useful links to use it are start.spring.io which now provides Spring Native support and the getting started section of the reference documentation .

Spring Native support in available on start.spring.io

Make sure to configure properly the Spring AOT Maven and Gradle plugins that are mandatory to get proper native support for your Spring application.

Enjoy!

like image 184
Sébastien Deleuze Avatar answered Sep 21 '22 12:09

Sébastien Deleuze