# spring-graalvm-native **Repository Path**: mirrors_dsyer/spring-graalvm-native ## Basic Information - **Project Name**: spring-graalvm-native - **Description**: Graal feature for building native images of Spring applications - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README :version: 0.6.1.RELEASE :repository: milestone :boot-version: 2.3.0.M4 :graalvm-version: 20.0.0 :graalvm-dev-version: 20.1-dev :boot-dev-version: 2.3.0.RELEASE :documentation-url: https://repo.spring.io/{repository}/org/springframework/experimental/spring-graal-native-docs/{version}/spring-graal-native-docs-{version}.zip! image:https://ci.spring.io/api/v1/teams/spring-graalvm-native/pipelines/spring-graalvm-native/badge["Build Status", link="https://ci.spring.io/teams/spring-graalvm-native/pipelines/spring-graalvm-native"] image:https://img.shields.io/badge/documentation-blue.svg["Documentation", link="{documentation-url}/reference/index.html"] This project goal is to provide experimental support for building https://spring.io/projects/spring-boot[Spring Boot] applications as https://www.graalvm.org/docs/reference-manual/native-image/[GraalVM native images]. Watch this https://www.youtube.com/watch?v=3eoAxphAUIg[Running Spring Boot applications as GraalVM native images] Devoxx talk video for more details. It is mainly composed of 6 parts: - `spring-graalvm-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-graalvm-native-configuration`: this module contains configuration hints for Spring classes, including various Spring Boot auto-configurations. - `spring-graalvm-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-graalvm-native`: this module aggregates the feature, configuration and substitutions ones to generate the artifact to consume. - `spring-graalvm-native-samples`: contains various samples that demonstrate the feature usage and are used as integration tests. - `spring-graalvm-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. 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 https://github.com/oracle/graal/labels/spring[are identified by the `spring` label]. == Quick start For detailed information and walkthroughs of applying the techniques to your project, please see the {documentation-url}/reference/index.html[documentation]. === Install GraalVM native If you are using Docker based builds descried above, the right GraalVM distribution is already installed, you can skip this section. From GraalVM builds: - Install GraalVM {graalvm-version} from https://github.com/graalvm/graalvm-ce-builds/releases[here] (dev builds are also available from https://github.com/graalvm/graalvm-ce-dev-builds/releases[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 https://sdkman.io/[SDKMAN] to easily switch between GraalVM versions: - https://sdkman.io/install[Install SDKMAN] - Install GraalVM with `sdk install java {graalvm-version}.r8-grl` for Java 8 or `sdk install java {graalvm-version}.r11-grl` for Java 11 - Run `gu install native-image` to bring in the native-image extensions to the JDK. === Artifacts The latest {version} release supports GraalVM {graalvm-version} and Spring Boot {boot-version}. - Artifact: https://repo.spring.io/{repository}/org/springframework/experimental/spring-graalvm-native/{version}/spring-graalvm-native-{version}.jar[`org.springframework.experimental:spring-graalvm-native:{version}`] - Repository: https://repo.spring.io/{repository}[`https://repo.spring.io/{repository}`] === Play with the samples - Download and extract https://github.com/spring-projects-experimental/spring-graalvm-native/archive/{version}.zip[sources from the latest release]. - Go into the samples folder and pick one (e.g. `cd spring-graalvm-native-samples/commandlinerunner`) - Run `./build.sh` which will run a maven build, then a native image compile, then test the result. `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 {documentation-url}/reference/index.html#samples[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 {documentation-url}/reference/index.html#extension_guide[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. === Baseline The development version on `master` is currently based on GraalVM {graalvm-dev-version} and Spring Boot {boot-dev-version}. Mac and Linux are supported, Windows in untested. === Use Docker based build environment In order to allow easily reproducible builds of `spring-graalvm-native`, dedicated interactive Docker images are available for local development (and are also used in the CI). To use it: - https://docs.docker.com/engine/install/[Install Docker]. - https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user[Configure it to allow non-root user] if you are on Linux. - Run `docker/build-dev-images.sh` to build the `spring-graalvm-native-dev` Docker images dedicated for development, they are based (multi-stage builds) on the https://hub.docker.com/r/springci/graalvm-ce/tags[`graalvm-ce`] and https://hub.docker.com/r/springci/spring-graalvm-native/tags[`spring-graalvm-native`] images https://ci.spring.io/teams/spring-graalvm-native/pipelines/spring-graalvm-native?group=Daily%20builds[built on the CI]. - You can now invoke `docker/run-{graalvm-dev-version}-java8.sh` or `docker/run-{graalvm-dev-version}-java11.sh` to run the Docker container with an interactive shell suitable to run `spring-graalvm-native` build scripts (see "Usual dev workflow" section bellow for more details). - The `spring-graalvm-native` directory and the Maven home directory are shared between the host (where is typically the IDE) and the container (where you can run builds). === Usual dev workflow - Import the root project in your IDE. - Eventually import the sample you are working on as a distinct project in your IDE. - Follow instructions from the "Use Docker based build environment" section above. - Run the root project `build.sh` (from the host or the container) if you have made modification to the feature, substitutions or configuration modules. - Run `build.sh` of the sample you are working on from the container. To test the various samples You can also run the root `build.sh` then `build-key-samples.sh` (test only key samples) or `build-samples.sh` (test all samples) from the container. == License https://www.apache.org/licenses/LICENSE-2.0[Apache License v2.0]