Git: 2.49.0
Spring Boot: 3.5.0
Maven: 3.9+
Java GraalVM: 24
Docker Desktop: Tested on 4.42.0
Using SDKMAN (Recommended)
sdk install java 24.0.2-graalInstall GraalVM JDK 24
Set GRAALVM_HOME as environment path.
git clone https://github.com/deepaksorthiya/spring-boot-graalvm-native.git
cd spring-boot-graalvm-native./mvnw -Pnative native:compileIt will generate a spring-boot-graalvm-native in target folder.
./target/spring-boot-graalvm-nativeCheck pom.xml for native container image config
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>deepaksorthiya/${project.artifactId}:latest</name>
<publish>false</publish>
<createdDate>${maven.build.timestamp}</createdDate>
<builder>bellsoft/buildpacks.builder:musl</builder>
<env>
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
<BP_JVM_VERSION>24</BP_JVM_VERSION>
</env>
</image>
<layers>
<enabled>true</enabled>
</layers>
</configuration>
</plugin>./mvnw clean -Pnative spring-boot:build-image -DskipTestsdocker build --progress=plain -f Dockerfile.native -t deepaksorthiya/spring-boot-graalvm-native .docker run -p 8080:8080 --name spring-boot-graalvm-native deepaksorthiya/spring-boot-graalvm-native./mvnw -PnativeTest testhttp://localhost:8080/h2-console
For further reference, please consider the following sections:
- Spring Boot GraalVM
- GraalVM Oracle Docs
- GraalVM Native Dockerfile
- Build Java Apps with Paketo Buildpacks
- GraalVM Native Image Support
- Configure AOT settings in Build Plugin
- Create an OCI image
- Spring Boot Actuator
- Spring Web
The following guides illustrate how to use some features concretely: