Spring Boot Configuration Reference

Comprehensive configuration reference for Spring Boot 4.0.5 workloads running on OpenShift and Kubernetes. Covers all 9 demos from container images through Panama FFM.

View on GitHub ↗

Container Images

Java 21: ubi9/openjdk-21-runtime (Shenandoah default) or eclipse-temurin:21-jre (G1GC default).
Java 25: eclipse-temurin:25-jre for Leyden, Panama, ONNX demos.

Multi-Stage Containerfile Pattern

FROM maven:3.9-eclipse-temurin-21 AS builder
WORKDIR /app
COPY . .
RUN ./mvnw package -DskipTests
FROM ubi9/openjdk-21-runtime
COPY --from=builder /app/target/*.jar app.jar
ENTRYPOINT ["java",
  "-XX:+UseContainerSupport",
  "-XX:MaxRAMPercentage=75.0",
  "-jar", "app.jar"]

Sections

Key differences from Quarkus:

GC Selection

Spring Boot has no framework-level GC property. Set GC via JAVA_OPTS environment variable or JVM arguments: -XX:+UseZGC, -XX:+UseG1GC, or -XX:+UseShenandoahGC.

AppCDS (35-55% improvement)

Spring Boot benefits dramatically from AppCDS because it loads 8,000-12,000 classes at startup. Uses a 3-stage Containerfile: build, train (-XX:ArchiveClassesAtExit), run (-XX:SharedArchiveFile).

Leyden AOT Cache

No single-property shortcut. Explicit -XX:AOTMode=record, -XX:AOTMode=create, and -XX:AOTCache=app.aot steps required. Use -Dspring.context.exit=onRefresh to exit training cleanly.

Metrics via Actuator

Prometheus endpoint at /actuator/prometheus (not /q/metrics). Requires management.endpoints.web.exposure.include=prometheus and management.prometheus.metrics.export.enabled=true.

gRPC — Spring Boot 4.0

First-class support via spring-grpc-spring-boot-starter. Configure port with spring.grpc.server.port. No third-party library needed.

Panama FFM

Same JDK 22+ API. Spring Boot needs --enable-native-access=ALL-UNNAMED as a JVM flag. Wire native components via @Configuration + @Bean.

Common pitfalls covered: Unqualified image names in Podman, SELinux bind mounts (:Z), named volume permissions, fat JAR classpath ordering for AppCDS, Leyden JVM fingerprint mismatch, --enable-native-access missing for Panama, Actuator endpoint exposure, Maven wrapper permissions.
File location in repo
spring-boot-demos/SPRING-BOOT-README.md