Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 2.12 KB

SpringBoot.md

File metadata and controls

44 lines (32 loc) · 2.12 KB

Start a Spring Boot Project

Create a Spring Boot application using the Spring Initializr API:

kool create spring-boot my-spring-app

The wizard asks for the application coordinates, then fetches the current language, Java version, and dependency options from the Spring Initializr metadata API. This keeps the choices in sync with the provider instead of hardcoding them locally.

The Gradle Docker presets support Java 17, 21, and 25. Other Java versions returned by Initializr are rejected before installing the preset configuration.

After the project is generated, database and cache services are optional. Available databases include PostgreSQL, MySQL, MariaDB, MongoDB, H2, and SQLite. H2 and SQLite use local file-backed data directories under data/; Redis and Memcached are available as cache services.

Only dependencies compatible with the default Spring Boot version are offered. The Docker image JDK in kool.yml and docker-compose.yml follows the Gradle toolchain generated by Initializr (for example, Kotlin projects may target an older JDK than the one requested).

Non-interactive usage

Every question can be answered with --answer REF=value (-a), so the preset can run without a terminal. Options accept their value or their label, and dependencies take a comma-separated list. Use --no-interaction (-n) to fail on any missing answer instead of prompting.

Ref Question
SPRING_GROUP Group
SPRING_ARTIFACT Artifact
SPRING_NAME Application name
SPRING_LANGUAGE Language (java, kotlin, groovy)
JAVA_VERSION Java version
SPRING_DEPENDENCIES Dependencies (Initializr ids, e.g. web,actuator)
JAVA_DB Database service (e.g. None, PostgreSQL 16)
JAVA_CACHE Cache service (e.g. None, Redis 7.0)
kool create spring-boot my-spring-app -n \
  -a SPRING_GROUP=com.example -a SPRING_ARTIFACT=demo -a SPRING_NAME=demo \
  -a SPRING_LANGUAGE=kotlin -a JAVA_VERSION=25 \
  -a SPRING_DEPENDENCIES=web,actuator,validation \
  -a JAVA_DB=None -a JAVA_CACHE=None

Run the generated application with:

kool run run