java-springboot

Applies Spring Boot 3.3 conventions for package structure, DTOs, transactions, and JPA repositories.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula --skill java-springboot-serpro-workshop-fortaleza
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-springboot
Source: https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula/tree/main/.github/skills/java-springboot
Command: npx skills add https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula --skill java-springboot-serpro-workshop-fortaleza

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When building or reviewing the Spring Boot server layer of the SIFAP 2.0 modernization (Java 21, PostgreSQL 16), developers need consistent, idiomatic structure. This Skill provides a quick checklist of best practices so controllers, services, and repositories follow the same conventions enforced by CI. ## Core Features & Use Cases - Feature-sliced structure: Organizes code by domain (e.g., com.sifap.payment) with constructor injection and immutable private final dependencies. - Layer conventions: Enforces record DTOs with Bean Validation at controller boundaries, @Transactional only on services, and Spring Data JPA repositories with projections. - Configuration and security: Guides externalized configuration with @ConfigurationProperties, Spring profiles, and secret management via environment variables or Azure Key Vault. - Use Case: Ask the assistant to scaffold a new feature slice (controller, service, repository) for a payment module, and it produces an idiomatic /api/v1 endpoint with a record DTO, a transactional service, and a JpaRepository. ## Quick Start Ask the assistant to create the structure of a new feature slice with controller, service, and repository for your Spring Boot module following these best practices.

Frequently Asked Questions about java-springboot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Spring Boot project by feature?

Organize packages by domain or bounded context, such as com.example.app.order, rather than by technical layer like controller or service. Each feature package contains its own controller, service, and repository, and modules never import another module's internals.

How to handle validation and errors in Spring Boot REST controllers?

Apply Bean Validation annotations like @Valid, @NotBlank, and @Positive on record request DTOs at the controller boundary. Centralize error handling in a single @RestControllerAdvice that returns ProblemDetail responses following RFC 7807.

Where should @Transactional be placed in Spring Boot?

Place @Transactional only on service-layer classes, never on controllers or repositories. For read operations, use @Transactional(readOnly = true) to optimize database access.

Should Spring Boot controllers return JPA entities?

No. Expose Java 21 record DTOs at API boundaries and never return JPA entities to clients. Use DTO projections in repositories to fetch only the data each endpoint needs.

How do I manage secrets in a Spring Boot application on Azure?

Never hardcode secrets in application.yml or source code. Use environment variables locally and Azure Key Vault through Managed Identity in Azure deployments, with Spring profiles separating environment-specific configuration.