Java Springboot
GitHubOfficialFirst committed by jduboisDistributed by GitHub
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides rules and best practices for developing features within an established Spring Boot 3 or 4 project. It covers essential areas including configuration management, data access, REST API design, messaging, and startup optimization. The skill emphasizes maintaining consistency with existing project conventions, verifying changes through the project's build system, and avoiding implicit upgrades or unauthorized infrastructure additions.
What it does
- Provides guidance on implementing controllers, validation, and ProblemDetail error handling.
- Offers patterns for Spring Data JPA/JDBC, RestClient, and HTTP interfaces.
- Details configuration management using type-safe properties and profiles.
- Covers integration of messaging systems like Kafka and AMQP, caching, and scheduling.
- Explains startup tuning techniques including AOT, CDS, and virtual threads.
- Enforces strict adherence to existing project build tools and versioning conventions.
When to use it
- When you need to add new features or modify existing code in a Spring Boot 3 or 4 project.
- When implementing new configuration properties or managing environment-specific settings.
- When optimizing application startup times or memory usage using AOT or CDS.
- When integrating new messaging, caching, or database components into an existing codebase.
Advantages
- Ensures consistency by matching existing project structure, versions, and naming conventions.
- Promotes safe development practices by requiring build verification before finalizing changes.
- Provides clear guidance on modern Spring Boot features like virtual threads and AOT.
- Reduces configuration errors through type-safe property binding and validation.
Usage examples
- “How do I add a new configuration property for my mail service in my Spring Boot 4 project?”
- The agent will provide a code snippet for a type-safe record using @ConfigurationProperties and explain how to register it using @ConfigurationPropertiesScan.
- “I need to implement a REST endpoint that returns a custom error using ProblemDetail.”
- The agent will guide you to create a @RestControllerAdvice and demonstrate how to map exceptions to the RFC 7807 ProblemDetail format.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/github/java-springboot/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip java-springboot.zip -d .agents/skills
Documentation by jdubois
Spring Boot application development
Opinionated rules plus a router to deeper references. Code samples in the references were compiled and run on Spring Boot 4.1.1 (Spring Framework 7) and, where they differ, on Boot 3.5.16 (Framework 6.2). Boot 3 vs 4 differences are marked "Boot 3" / "Boot 4" in each reference.
Before writing code
Detect, do not assume: read
pom.xml/build.gradle(.kts)for the Spring Boot version, Java version, starters in use (spring-boot-starter-webis Boot 3,spring-boot-starter-webmvcis Boot 4), persistence (JPA, JDBC), the migration tool, the test setup, and the package layout and naming conventions of the existing code. Match them.Never upgrade Spring Boot, Java or dependencies implicitly. A Boot 3 -> 4 move is a deliberate task (
spring-boot-4-migration).Ask before adding infrastructure: a broker (Kafka, RabbitMQ), a cache provider, a new database, or a scheduler/async setup. Add only what the user requested, with the Boot-managed version (no explicit version for BOM-managed artifacts, never
latest).Verify every change with the project's own build:
./mvnw verifyor./gradlew build(plainmvn/gradleif no wrapper). Integration tests need Docker when they use Testcontainers.
Router
| Task | Read |
|---|---|
Repositories, projections, pagination, N+1, @Transactional, auditing, Flyway/Liquibase, Spring Data JDBC | references/data.md |
Controllers, validation, ProblemDetail, RestClient, @HttpExchange, API versioning, OpenAPI, JSpecify | references/rest-api.md |
Kafka/AMQP, @Cacheable/Caffeine, @Scheduled, @Async, virtual threads, outbox | references/messaging-caching.md |
@ConfigurationProperties, profiles, secrets, config import, Docker Compose / Testcontainers at dev time | references/configuration.md |
| AOT, CDS/AppCDS, lazy initialization, native image | references/aot-and-startup.md |
If these standalone skills are installed, also use them for their topic; otherwise rely on the official docs: java-hibernate-jpa (JPA mapping), spring-boot-testing (tests), spring-security (authentication, authorization, CSRF/CORS), spring-observability (metrics, tracing, Actuator, logs), create-spring-boot-java-project (project defaults, Boot 3 vs 4 build changes), java-add-graalvm-native-image-support (native executable).
Core rules
Structure and layers: package by feature; constructor injection; controllers return DTOs/records, never entities; services own the transaction.
Validation and errors: Bean Validation on request records with
@Valid; one@RestControllerAdvicereturningProblemDetail. JSpecify annotations document nullability only and do not validate.Jackson: Boot 4 uses Jackson 3 (
tools.jackson.databind.*,JsonMapper; annotations stay incom.fasterxml.jackson.annotation); Boot 3 uses Jackson 2 (com.fasterxml.jackson.databind.*,ObjectMapper).Slice-test gotcha: put
@EnableJpaAuditing,@EnableCaching,@EnableAsync,@EnableSchedulingon dedicated@Configurationclasses, not on the@SpringBootApplicationclass, or slices such as@DataJpaTestfail to start (for example, noCacheManager). Slices do not scan@Configurationclasses:@Importthe one a test needs.Proxied beans:
@Cacheable,@Asyncand@Transactionalwork through proxies: they do nothing on self-invocation or onprivate/finalmethods; test them through the injected bean.
Checklist
[ ] Versions, build tool and conventions detected; starters match the Boot major
[ ] No new infrastructure or dependency without the user's agreement
[ ]
./mvnw verify/./gradlew buildpasses; secrets absent from code, properties and logs
See also: Spring Boot reference https://docs.spring.io/spring-boot/reference/, Spring Framework reference https://docs.spring.io/spring-framework/reference/, Spring Data https://docs.spring.io/spring-data/commons/reference/.
Files
- ATTRIBUTION.mdAdded by AutoGineer861 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md4.3 KiB
- references/aot-and-startup.md5.3 KiB
- references/configuration.md5.0 KiB
- references/data.md5.9 KiB
- references/messaging-caching.md7.2 KiB
- references/rest-api.md9.0 KiB
references/aot-and-startup.md
AOT, CDS and startup
Start with measurement, not flags: record startup time (Started ... in N seconds log, or spring.main.log-startup-info=true) and memory on the target hardware before and after each change, with several runs (single timings are noisy: observed differences between runs of the same configuration were larger than some of the gains). Do not change JVM or Spring flags without a stated goal (startup, memory, image size). Verified on Boot 4.1.1, Maven, JDK 26 runtime (--release 25); JDK 21 and 25 were not available for these runs.
Spring AOT (build-time processing)
Spring AOT turns bean definitions and reflection/proxy hints into generated code. It is required for GraalVM native images and optional on the JVM.
./mvnw -DskipTests package spring-boot:process-aot # Gradle: ./gradlew processAotVerified: on the sample app (JPA, Flyway, Kafka, cache, validation, springdoc) process-aot succeeded and generated sources under target/spring-aot/main/sources/ (for example DemoApplication__BeanDefinitions.java). Notes:
AOT evaluates conditions and bean definitions at build time: profiles and properties that change the bean graph (
@Profile,@ConditionalOnProperty) are fixed at build time. Do not rely on runtime-only conditions.process-aotstarts the application context without connecting your beans to real services; if it fails, the usual causes are beans with runtime-only side effects in constructors or an ambiguous main class (set<start-class>in Maven, seecreate-spring-boot-java-projectreferences/spring-boot-4.md).Custom reflection/resources: register hints with
@ImportRuntimeHintsandRuntimeHintsRegistrar, or@RegisterReflectionForBindingfor DTOs serialized by Jackson.Using the generated code on the JVM requires running with
-Dspring.aot.enabled=trueand packaging the AOT output; that path was not verified here and gives modest gains, so prefer CDS/AOT cache below for JVM startup.
Native image
For a native executable use the java-add-graalvm-native-image-support skill (build tool detection, native build, error iteration) and the native Dockerfiles of create-spring-boot-java-project (references/docker.md). Trade-offs: much faster startup and lower memory, but slower builds, closed-world assumptions (reflection hints), and some libraries need extra hints. Not verified in this skill.
Class Data Sharing (CDS) / Application CDS
Spring Boot supports CDS through the extracted jar layout (-Djarmode=tools). Verified sequence on Boot 4.1.1 (the training run needs the app's dependencies, here a PostgreSQL):
./mvnw -DskipTests package
java -Djarmode=tools -jar target/app.jar extract --destination extracted
cd extracted
# training run: create the archive on exit (the app exits right after context refresh)
java -XX:ArchiveClassesAtExit=app.jsa -Dspring.context.exit=onRefresh -jar app.jar
# production run
java -XX:SharedArchiveFile=app.jsa -jar app.jarVerified: app.jsa (about 50 MB for the sample app) was created and used without errors. The [warning][cds] Skipping ... Failed verification and NoClassDefFoundError preload warnings in the training run concern optional classes whose libraries are not on the classpath (reactor, Apache HttpClient, Log4j) and are harmless. The archive is tied to the exact JVM and jar: regenerate it in the build or image build for each version, and run the training with the same JDK as production.
JDK 19+ can also create the archive automatically at the first run (-XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=app.jsa; verified that the file is created).
JDK 25+ one-step AOT cache (JEP 514): java -XX:AOTCacheOutput=app.aot -Dspring.context.exit=onRefresh -jar app.jar, then java -XX:AOTCache=app.aot -jar app.jar. Verified on JDK 26 (about 160 MB cache, used without errors). JDK 24 introduced AOT caches (JEP 483) but requires separate AOTMode=record and AOTMode=create steps; it does not recognize AOTCacheOutput. Check java -version before choosing the command, and keep CDS as the fallback for older JDKs. Same rule: one cache per JDK build and jar.
In containers, create the archive during docker build (a RUN training step in the final stage) rather than at container start.
Lazy initialization
spring.main.lazy-initialization=trueDefers bean creation to first use, which lowers startup time and memory at start but moves failures and the first-request latency to runtime: misconfigured beans no longer fail fast, and health checks may pass on a half-working app. Use it for dev/test or short-lived processes; avoid it as a production default. Set
@Lazy(false)on beans that must start eagerly (schedulers, listeners).Measured on the sample app: no consistent startup gain over several runs; do not promise one.
Other cheap wins
Remove unused starters and auto-configurations;
--debugprints the condition evaluation report to find what starts.spring.jpa.open-in-view=falseandspring.main.banner-mode=offcost nothing.Set
-XX:TieredStopAtLevel=1only for short-lived CLI-style jobs; it hurts steady-state throughput.Container memory: let the JVM size heap from container limits (
-XX:MaxRAMPercentage); do not hard-code-Xmxequal to the limit.Virtual threads do not change startup (
references/messaging-caching.md).
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.
Security
No issues found by our static scan· No issues found
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
jdubois
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/java-springboot · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- jdubois
AutoGineer is not affiliated with or endorsed by jdubois or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download java-springboot.zip