Skip to content

sdeleuze/spring-boot-cds-demo

Repository files navigation

Spring Boot CDS demo

This repository is intended to demonstrate how to use Spring Boot 3.3+ CDS support. See also https://github.com/sdeleuze/petclinic-efficient-container.

Pre-requisites

Docker is required to use Buildpacks which allows to build easily container images with CDS and Spring AOT enabled via the BP_JVM_CDS_ENABLED and BP_SPRING_AOT_ENABLED that are enabled in the build (build.gradle.kts for Gradle and pom.xml for Maven).

Check the application starts correctly without CDS involved:

./gradlew bootRun

Or with Maven

./mvnw spring-boot:run

Check the startup time, for example on my MacBook Pro M2:

Started CdsDemoApplication in 0.575 seconds (process running for 0.696)

Build and run with CDS

Build the container image with Gradle.

./gradlew bootBuildImage

Or with Maven

./mvnw spring-boot:build-image

Then run it with Docker:

docker run --rm -p 8080:8080 spring-boot-cds-demo:1.0.0-SNAPSHOT

Check the startup time which should now be significantly lower:

Started CdsDemoApplication in 0.294 seconds (process running for 0.371)

About

Demonstrate how to use Spring Boot 3.3+ CDS support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages