Skip to content

GraalVM native experimental support for Spring Boot applications

License

Notifications You must be signed in to change notification settings

narayan-khanna/spring-graal-native

 
 

Repository files navigation

Build Status Documentation

This project goal is to provide experimental support for building Spring Boot applications as GraalVM native images. Watch this Running Spring Boot applications as GraalVM native images Devoxx talk video for more details.

It is mainly composed of 6 parts:

  • spring-graal-native-feature: this module is Spring GraalVM feature. A feature here is a GraalVM term meaning a plugin for the native-image compilation process (which creates the native-image from the built class files). The feature participates in the compilation lifecycle, being invoked at different compilation stages to offer extra information about the application to aid in the image construction.

  • spring-graal-native-configuration: this module contains configuration hints for Spring classes, including various Spring Boot auto-configurations.

  • spring-graal-native-substitutions: this module allows to patch temporarily some part of Spring Boot and Spring Framework to improve compatibility and efficiency of Spring native images.

  • spring-graal-native: this module aggregates the feature, configuration and substitutions ones to generate the artifact to consume.

  • spring-graal-native-samples: contains various samples that demonstrate the feature usage and are used as integration tests.

  • spring-graal-native-docs: contains the asciidoc documentation sources.

Scope and status

This project status is alpha, that means that we are currently mainly working on the software design and on supporting the features of the current samples (work in progress). Supporting a wider and clearly defined range of Spring Boot applications, as well as optimizing efficiency (image size, memory consumption) and performances will happen as a second step.

This feature supports:

  • GraalVM 20.0.0

  • Spring Boot 2.3.0.M4

Spring team collaborates with GraalVM native team by raising issues in their bug tracker, with the goal to improve the production-readiness of native-images. These bugs on GraalVM issue tracker are identified by the spring label.

Quick start

For detailed information and walkthroughs of applying the techniques to your project, please see the documentation.

Install GraalVM native

From GraalVM builds:

  • Install GraalVM from here (dev builds are also available here).

  • Set JAVA_HOME and PATH appropriately for that GraalVM version.

  • Run gu install native-image to bring in the native-image extensions to the JDK.

Or you can use SDKMAN to easily switch between GraalVM versions:

  • Install SDKMAN

  • Install GraalVM with sdk install java 20.0.0.r8-grl for Java 8 or sdk install java 20.0.0.r11-grl for Java 11

  • Run gu install native-image to bring in the native-image extensions to the JDK.

Play with the samples

build.sh runs the compile.sh script and in that compile script you can see the invocation of the native-image command. The other samples follow a similar model. For more details on the samples see the samples documentation.

Contributing

This project is in the spring-projects-experimental org indicating it is not as mature as other Spring projects. Contributions are welcome (maybe read the extension guide if thinking about extending it to support your project). However, please recognize we aren’t at the polishing javadoc stage and whilst pre 1.0 there may be heavy evolution of APIs.

About

GraalVM native experimental support for Spring Boot applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 89.6%
  • Shell 7.0%
  • HTML 2.0%
  • CSS 1.1%
  • Other 0.3%