Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sdeleuze/spring-boot-cds-demo
Demonstrate how to use Spring Boot 3.3+ CDS support
https://github.com/sdeleuze/spring-boot-cds-demo
Last synced: 3 months ago
JSON representation
Demonstrate how to use Spring Boot 3.3+ CDS support
- Host: GitHub
- URL: https://github.com/sdeleuze/spring-boot-cds-demo
- Owner: sdeleuze
- License: apache-2.0
- Created: 2023-11-21T15:12:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-20T14:55:13.000Z (7 months ago)
- Last Synced: 2024-10-11T16:11:25.291Z (3 months ago)
- Language: Java
- Homepage:
- Size: 89.8 KB
- Stars: 21
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring Boot CDS demo
This repository is intended to demonstrate how to use [Spring Boot 3.3+ CDS support](https://docs.spring.io/spring-boot/how-to/class-data-sharing.html). See also https://github.com/sdeleuze/petclinic-efficient-container.
## Pre-requisitesDocker 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:
```bash
./gradlew bootRun
```Or with Maven
```bash
./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.
```bash
./gradlew bootBuildImage
```Or with Maven
```bash
./mvnw spring-boot:build-image
```Then run it with Docker:
```bash
docker run --rm -p 8080:8080 spring-boot-cds-demo:1.0.0-SNAPSHOT
```Check the startup time which should now be significantly lower:
```bash
Started CdsDemoApplication in 0.294 seconds (process running for 0.371)
```