Skip to content

Work in progress in running Spring Boot apps as a native image

Notifications You must be signed in to change notification settings

snicoll-scratches/demo-native-sample

Repository files navigation

Native sample with Spring Boot 3

This sample can be used to hack on Native with Spring Boot 3.

Note
This is a work in progress and requires a local build of Spring Boot.

Setup

You need to install a version of Spring Boot 3.0.0-SNAPSHOT from the aot branch

$ git checkout aot
$ ./gradlew publishToMavenLocal

You also need to have a native-image in your path. The easiest way to get started is with SDKMan:

$ sdk install java 22.0.0.2.r17-nik

Once GraalVM is installed, you need to use it in your shell:

$ sdk use java 22.0.0.2.r17-nik

Validate that GraalVM is available in your shell:

$ java -version
openjdk version "17.0.2" 2022-01-18 LTS
OpenJDK Runtime Environment GraalVM 22.0.0.2 (build 17.0.2+9-LTS)
OpenJDK 64-Bit Server VM GraalVM 22.0.0.2 (build 17.0.2+9-LTS, mixed mode, sharing)

Building

To build the project and generate a native image for it, run the following command:

$ ./mvnw package -Pnative

Running

One the build has completed, the native executable is in your target directory. You can run it as follows:

$ target/demo-native-sample

About

Work in progress in running Spring Boot apps as a native image

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages