Skip to main content
PreparationZone Logo
PrepZone

Spring Native and GraalVM

Native image compilation, AOT hints, and when JVM deployment still wins.

Pass checkpoint below

Why this matters

  • Cold start and memory footprint matter for scale-to-zero on Kubernetes.
  • Native images trade build time and reflection limits for startup speed.
  • You should articulate when JVM mode remains the better default for BookStore.

Native image

L1 · Fresher

GraalVM ahead-of-time compilation produces fast-starting binaries — useful for scale-to-zero on Kubernetes.

Spring AOT

L2 · Intermediate

Boot 3 AOT processing generates reflection config at build time — required for native image success.

Trade-offs

L3 · Advanced

Longer builds, limited dynamic features, and harder debugging vs JVM's mature tooling.

When JVM still wins

L4 · Expert

Heavy JIT throughput, frequent deployments without cold start, and libraries with incomplete native metadata.

Maven/Gradle build
Spring AOT
native-image
Container binary
AOT processing ahead of GraalVM native-image produces a fast-starting binary with trade-offs.

Hook

BookStore edge services need sub-second cold start on AWS Lambda or minimal container images. Spring Native with GraalVM ahead-of-time compilation produces a standalone binary — at the cost of build time and reflection configuration.

Native profile and plugin

Java
<plugin>
  <groupId>org.graalvm.buildtools</groupId>
  <artifactId>native-maven-plugin</artifactId>
</plugin>

Run ./mvnw -Pnative native:compile on Java 21 with GraalVM installed. Spring Boot 3.5’s AOT processing generates reachability metadata for many starters.

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 6 sections

  • What breaks reflection
  • Testing native binaries
  • BookStore in action
  • Runnable BookStore lab
  • Failure modes in production
  • Memory and footprint

Test yourself

Answer these before moving on — recall is what makes it stick.