Create Spring Boot Java Project
GitHubOfficialFirst committed by wuwen5Distributed by GitHub
- Skill
- Workflow
- Software development
- MIT
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill automates the creation of Spring Boot applications by interacting with the start.spring.io API. It provides a structured approach to bootstrapping projects using either Maven or Gradle, while applying opinionated defaults for configuration, database connectivity, logging, security, and containerization. The skill includes logic to detect existing project structures to prevent accidental overwrites or unauthorized version upgrades, ensuring consistency across the development lifecycle.
What it does
- Generates new Spring Boot projects via start.spring.io API
- Supports both Maven and Gradle build systems
- Applies standardized configurations for PostgreSQL, logging, and security
- Detects existing project files to avoid regeneration
- Provides Dockerfile templates for JVM and native images
- Verifies project setup through build and health check commands
When to use it
- When you need to bootstrap a new Spring Boot application
- When you require a consistent project structure with standard dependencies
- When you need to integrate PostgreSQL, Testcontainers, or Docker support
- When you need to ensure configuration best practices like externalized secrets
Advantages
- Ensures consistent project structure and dependency management
- Prevents accidental version upgrades in existing projects
- Automates the setup of essential development and testing tools
- Reduces manual configuration effort for standard Spring Boot features
Usage examples
- “Create a new Spring Boot project named my-app using Maven.”
- The agent will generate a new Spring Boot project structure in a directory named my-app using Maven, including default dependencies and configuration files.
- “Bootstrap a Spring Boot application with PostgreSQL and security.”
- The agent will scaffold a project with the necessary dependencies for JPA, PostgreSQL, and Spring Security, and configure the initial application properties.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/github/create-spring-boot-java-project/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip create-spring-boot-java-project.zip -d .agents/skills
Documentation by wuwen5
Create a Spring Boot Java project
Scaffold a Spring Boot application with start.spring.io, then apply a small set of opinionated defaults. Out of scope for now: front-ends (Vue/React/Angular), cloud deployment (Azure), Git setup, CRaC and AOT images.
Step 0: Detect before you create
If the working directory already contains a
pom.xmlorbuild.gradle(.kts), this is an existing project: do not regenerate it. Read its Spring Boot, Java and test-framework versions and follow them. Never upgrade versions implicitly; propose an upgrade and wait for the user's decision.Check the tools:
java -version(JDK matching the chosen Java version),docker --version(needed for Testcontainers and Compose). On the default path (current Boot via start.spring.io) Maven/Gradle need not be installed: the generated wrapper is used. The Boot 3.5 fallback needs Maven or Gradle installed once to create the wrapper (see versions.md).Ask only for what is missing: project name, group id, package, build tool (default Maven), dependencies (default: web, actuator, validation, devtools; add
data-jpa,postgresql,security,docker-compose,testcontainerswhen a database or auth is needed).
Step 1: Resolve versions
Follow references/versions.md: query https://start.spring.io/metadata/client at run time for the latest stable Spring Boot release, fall back to the documented pinned values if offline. Do not hardcode latest anywhere.
Step 2: Generate the project
Use the start.spring.io HTTP API with explicit, pinned parameters (no piped installers). Replace the values in capitals.
Maven:
curl -fsS https://start.spring.io/starter.zip \
-d type=maven-project -d language=java -d packaging=jar \
-d bootVersion=BOOT_VERSION -d javaVersion=JAVA_VERSION \
-d groupId=com.example -d artifactId=demo -d name=demo \
-d packageName=com.example.demo -d baseDir=demo \
-d dependencies=web,actuator,validation,devtools \
-o demo.zip && unzip -q demo.zip && rm demo.zipGradle: same command with -d type=gradle-project (Groovy DSL) or -d type=gradle-project-kotlin (Kotlin DSL; the language stays java).
Inspect the result (ls demo, read the build file) and make sure the wrapper (mvnw or gradlew) is executable. Add -d dependencies=...,data-jpa,postgresql,docker-compose,testcontainers for a database project.
Step 3: Apply the defaults
| Area | What to do | Reference |
|---|---|---|
| Boot 3 vs 4 differences | Starter names, Jackson 3, test modules | references/spring-boot-4.md |
| Configuration | application.properties or .yml (match the project), profiles, @ConfigurationProperties, secrets via environment | references/configuration.md |
| Database | PostgreSQL, Hibernate settings, Compose for dev, Testcontainers for tests | references/database.md |
| Logging | SLF4J, parameterized messages, levels, structured logging | references/logging.md |
| Security | Spring Security basics, secure defaults, Problem Details | references/security.md |
| Docker | JVM image and GraalVM native image Dockerfiles | references/docker.md |
| Testing | See the spring-boot-testing skill (slices, Testcontainers, Failsafe) | skills/spring-boot-testing |
| Best practices | See the java-springboot skill and instructions/springboot.instructions.md | skills/java-springboot |
Keep dotfiles minimal: a .gitignore covering target/, build/, .gradle/, IDE folders and .env; never commit .env (commit a .env.sample).
Step 4: Verify
Build and test:
./mvnw verify(Maven) or./gradlew build(Gradle).Run:
./mvnw spring-boot:runor./gradlew bootRun, thencurl -fsS localhost:8080/actuator/healthmust return{"status":"UP"}.Report the chosen versions and anything that was skipped or deferred.
Provenance
Adapted from the Apache-2.0 skill jdubois/dr-jskill; see references/PROVENANCE.md.
Files
- ATTRIBUTION.mdAdded by AutoGineer891 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md4.5 KiB
- assets/Dockerfile2.1 KiB
- assets/Dockerfile-gradle2.5 KiB
- assets/Dockerfile-native1.2 KiB
- assets/Dockerfile-native-gradle1.3 KiB
- references/PROVENANCE.md1.7 KiB
- references/configuration.md2.2 KiB
- references/database.md3.4 KiB
- references/docker.md4.4 KiB
- references/logging.md1.6 KiB
- references/security.md2.4 KiB
- references/spring-boot-4.md2.2 KiB
- references/versions.md2.6 KiB
references/docker.md
Docker
Four multi-stage Dockerfiles are provided: JVM and GraalVM native images, each for Maven and Gradle (Groovy or Kotlin DSL). Copy the one you need to the project root and build it with -f. AOT and CRaC images are deferred.
| Maven | Gradle | |
|---|---|---|
| JVM image | ../assets/Dockerfile | ../assets/Dockerfile-gradle |
| Native image | ../assets/Dockerfile-native | ../assets/Dockerfile-native-gradle |
Verified on Boot 4.1.1 (web + actuator + validation), arm64 Docker Desktop: all four build and serve /hello and /actuator/health. JVM images are about 200 MB and build in under a minute (about 2 s startup); native images are about 175 MB, take 2m20-2m55 to build (around 6 GB of builder memory) and start in about 0.09 s. The Gradle builds set the toolchain to the same Java version as the build stage (25).
Choosing
| JVM image | Native image | |
|---|---|---|
| Build time | Fast | Slow, memory hungry (several GB) |
| Startup / memory | Seconds / higher | Milliseconds / low |
| Compatibility | Everything | Needs GraalVM-compatible libraries; reflection hints may be needed |
| Pick when | Default choice | Scale-to-zero, CLI-like, tight memory limits |
Native requires the native dependency at generation time (-d dependencies=...,native) and the Spring Boot native Maven profile (included by start.spring.io when the dependency is selected).
Properties of the provided Dockerfiles
Multi-stage: build in a JDK/GraalVM image, run in a small runtime image.
JVM: the Boot jar is extracted into layers (
java -Djarmode=tools -jar app.jar extract --layers --launcher) for better caching, runtime assembled withjlink, final base is distrolessnonroot(no shell, no package manager).Native: the executable is built with
-H:+StaticExecutableWithDynamicLibCand copied into distrolessnonroot. Thefindthat picks the executable must skip*.so: GraalVM 25 leaves executablelibjava.so/libjvm.sostubs next to it, and copying one of those gives a container that exits with 139 (segfault).Run as non-root, expose 8080, JVM flags via
JAVA_TOOL_OPTIONS(no shell to expandJAVA_OPTS).Pinned base image tags (
eclipse-temurin:25-jdk-noble,ghcr.io/graalvm/graalvm-community:25,gcr.io/distroless/base-debian12:nonroot); match the Java version of the project and update when it changes. Consider pinning by digest for reproducibility.No Docker
HEALTHCHECK(distroless has no curl); probe/actuator/healthfrom the orchestrator (liveness/readiness:management.endpoint.health.probes.enabled=true).Keep a
.dockerignore(target/,build/,.git,.env, IDE files) so secrets and build output stay out of the context.
Build and run
docker build -t my-spring-app .
docker run --rm -p 8080:8080 \
-e SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/mydb \
-e SPRING_DATASOURCE_USERNAME=user -e SPRING_DATASOURCE_PASSWORD=password \
my-spring-appAlternative without a Dockerfile: ./mvnw spring-boot:build-image or ./gradlew bootBuildImage (Cloud Native Buildpacks; add -Pnative for native with Maven, Gradle needs the org.graalvm.buildtools.native plugin). Verified on Boot 4.1.1 (web + actuator + validation + data-jpa, Java 25): Maven native build-image about 2m40, 282 MB image; Gradle bootBuildImage 2-4 min, image starts in 0.1-0.2 s and /actuator/health returns UP with native-build-tools 1.1.7 and 1.1.8. A native image that crashes at startup with Invalid logger interface org.hibernate.validator.internal.util.logging.Log (implementation not found) was seen once with Gradle but could not be reproduced; it matches graalvm/native-build-tools#1017 (Gradle collectReachabilityMetadata overwrote the hibernate-validator metadata with the jboss-logging one, leaving a ~2 KB file). If it happens, check unzip -l build/libs/*.jar | grep hibernate-validator.*reachability-metadata.json (healthy is about 150 KB), upgrade org.graalvm.buildtools.native to the latest release and rebuild with --no-build-cache; always run the image and hit /actuator/health.
Development
Use spring-boot-docker-compose with compose.yaml for dependencies (see database.md); do not containerize the application itself during development.
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs network access
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
wuwen5
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/create-spring-boot-java-project · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- jdubois, wuwen5
AutoGineer is not affiliated with or endorsed by wuwen5 or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download create-spring-boot-java-project.zip