Create Spring Boot Java Project

Create Spring Boot Java Project

Scaffolds a new Spring Boot Java project from start.spring.io with sensible defaults for config, PostgreSQL, logging, security, tests and Docker, without silently upgrading existing versions.

Skill files13 files

assets/

references/

SKILL.md64 lines
1
---
2
name: create-spring-boot-java-project
3
description: 'Create a new Spring Boot Java project (Maven or Gradle) from start.spring.io with sensible defaults for configuration, PostgreSQL, logging, security, testing and Docker. Use when asked to scaffold, bootstrap or generate a Spring Boot application. Detects existing project versions and never upgrades implicitly.'
4
---
5
6
# Create a Spring Boot Java project
7
8
Scaffold a Spring Boot application with [start.spring.io](https://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.
9
10
## Step 0: Detect before you create
11
12
- If the working directory already contains a `pom.xml` or `build.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.
13
- 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](references/versions.md)).
14
- 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`, `testcontainers` when a database or auth is needed).
15
16
## Step 1: Resolve versions
17
18
Follow [references/versions.md](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.
19
20
## Step 2: Generate the project
21
22
Use the start.spring.io HTTP API with explicit, pinned parameters (no piped installers). Replace the values in capitals.
23
24
Maven:
25
26
```bash
27
curl -fsS https://start.spring.io/starter.zip \
28
-d type=maven-project -d language=java -d packaging=jar \
29
-d bootVersion=BOOT_VERSION -d javaVersion=JAVA_VERSION \
30
-d groupId=com.example -d artifactId=demo -d name=demo \
31
-d packageName=com.example.demo -d baseDir=demo \
32
-d dependencies=web,actuator,validation,devtools \
33
-o demo.zip && unzip -q demo.zip && rm demo.zip
34
```
35
36
Gradle: same command with `-d type=gradle-project` (Groovy DSL) or `-d type=gradle-project-kotlin` (Kotlin DSL; the language stays `java`).
37
38
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.
39
40
## Step 3: Apply the defaults
41
42
| Area | What to do | Reference |
43
|------|-----------|-----------|
44
| Boot 3 vs 4 differences | Starter names, Jackson 3, test modules | [references/spring-boot-4.md](references/spring-boot-4.md) |
45
| Configuration | `application.properties` or `.yml` (match the project), profiles, `@ConfigurationProperties`, secrets via environment | [references/configuration.md](references/configuration.md) |
46
| Database | PostgreSQL, Hibernate settings, Compose for dev, Testcontainers for tests | [references/database.md](references/database.md) |
47
| Logging | SLF4J, parameterized messages, levels, structured logging | [references/logging.md](references/logging.md) |
48
| Security | Spring Security basics, secure defaults, Problem Details | [references/security.md](references/security.md) |
49
| Docker | JVM image and GraalVM native image Dockerfiles | [references/docker.md](references/docker.md) |
50
| Testing | See the `spring-boot-testing` skill (slices, Testcontainers, Failsafe) | `skills/spring-boot-testing` |
51
| Best practices | See the `java-springboot` skill and `instructions/springboot.instructions.md` | `skills/java-springboot` |
52
53
Keep dotfiles minimal: a `.gitignore` covering `target/`, `build/`, `.gradle/`, IDE folders and `.env`; never commit `.env` (commit a `.env.sample`).
54
55
## Step 4: Verify
56
57
1. Build and test: `./mvnw verify` (Maven) or `./gradlew build` (Gradle).
58
2. Run: `./mvnw spring-boot:run` or `./gradlew bootRun`, then `curl -fsS localhost:8080/actuator/health` must return `{"status":"UP"}`.
59
3. Report the chosen versions and anything that was skipped or deferred.
60
61
## Provenance
62
63
Adapted from the Apache-2.0 skill [jdubois/dr-jskill](https://github.com/jdubois/dr-jskill); see [references/PROVENANCE.md](references/PROVENANCE.md).
64

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,327 prompts

More by @OpenSourceBuffGuy

See all
Giant chocolate bar towering over snowy mountain valley prompt image

Giant chocolate bar towering over snowy mountain valley

Draws a photorealistic chocolate advertisement of a gigantic bar towering over a snowy mountain valley, with tiny photographers and floating chocolate pieces.

image-prompt, product-photography, advertising, surreal, forced-perspective, mountains, winter, landscape, golden-hour, photorealistic, cinematic, vertical-format, luxury, food-photography, packaging-design, negative-prompt, gpt-image, chatgpt, quick, vibrant-colors, dramatic-lighting, wide-shot

Black adjustable dumbbells in a luxury gym prompt image

Black adjustable dumbbells in a luxury gym

Produces a 10-second premium commercial for black adjustable dumbbells in a luxury gym, moving from a low close-up and macro dials to a wide hero shot.

video-prompt, video-ad, product-video, multi-shot, timed-beats, macro, camera-movement, cinematic, photorealistic, natural-light, studio-lighting, product-photography, vertical-format, fitness, shallow-depth-of-field, luxury, for-marketers

1980s man in blazer, silk shirt and gold chain prompt image

1980s man in blazer, silk shirt and gold chain

Transforms a photo of a man into an authentic late-1980s Kodak film portrait with voluminous hair, a blazer and silk shirt, in a warm upscale interior, keeping his identity.

image-prompt, reference-image, face-reference, portrait, man, vintage, film-photography, film-grain, photo-editing, fashion, photorealistic, negative-prompt, hairstyles, jewelry, cozy, soft-lighting, bokeh, long-form, chatgpt, gpt-image, candid, style-transfer

Reviews

Loading reviews…

Discussion

Loading comments…