himozhang / demo-aot-native

Demo of a basic webapp using Ahead-Of-Time compilation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AOT and Native with Spring Boot 3

This repository provides a basic web application using Spring Boot 3 that can be built as a native image using GraalVM. It showcases how reflection and resources loading can be configured using RuntimeHints.

This sample can be seen in action in Ahead Of Time and Native in Spring Boot 3.0.

Building

To build this demo application, you need GraalVM 22.3 on your path. If you use SDKMan, invoke the following:

sdk install java 22.3.r17-nik

Maven

To build the application with Maven, you need to enable the native profile:

$ ./mvnw -Pnative native:compile

Gradle

To build the application with Gradle, you need to make sure that the org.graalvm.buildtools.native plugin is enabled.

$ ./gradlew nativeCompile

Testing

You can run your unit tests in a native image to verify that your application and its dependency work as expected.

Maven

To run your tests in a native image with Maven, you need to enable the nativeTest profile:

$ ./mvnw -PnativeTest test

Gradle

To run your tests in a native image with Gradle, you need to make sure that the org.graalvm.buildtools.native plugin is enabled.

$ ./gradlew nativeTest

About

Demo of a basic webapp using Ahead-Of-Time compilation


Languages

Language:Java 100.0%