Spring Boot Conventions

Enforces layered architecture, configuration, dependency injection, and logging conventions for Spring Boot projects.

Updated May 12, 2026
One-click install
npx skills add https://github.com/ZzZueszZ/claude-kit --skill spring-boot-conventions-zzzueszz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Spring Boot Conventions
Source: https://github.com/ZzZueszZ/claude-kit/tree/main/.claude/skills/spring-boot-conventions
Command: npx skills add https://github.com/ZzZueszZ/claude-kit --skill spring-boot-conventions-zzzueszz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Spring Boot projects often drift into inconsistent package structures, scattered configuration, field injection, and unsafe logging practices. This Skill provides a mandatory set of conventions so every Spring Boot codebase follows the same layered architecture and coding standards. ## Core Features & Use Cases - Standardized Project Structure: Defines a layered package layout (controller, service, repository, model, mapper, exception, security) with clear placement rules. - Configuration Management: Enforces application.yml over properties files, environment-variable placeholders for secrets, profile-based config splits, and @ConfigurationProperties instead of scattered @Value. - Dependency Injection & Logging Rules: Mandates constructor injection with Lombok @RequiredArgsConstructor, correct stereotype annotations, and SLF4J parameterized logging without sensitive data. - Use Case: When scaffolding a new Spring Boot microservice or reviewing existing code, apply these conventions to guarantee consistent structure, secure configuration, and clean logging before committing. ## Quick Start Ask the AI to review or generate a Spring Boot service class following the Spring Boot conventions for structure, injection, configuration, and logging.

Frequently Asked Questions about Spring Boot Conventions

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

FAQPage Schema
How do I structure a Spring Boot project with layered architecture?▼

Organize packages by layer: controller, service, repository, model (entity, dto, enums), mapper, exception, security, config, and util. Place the main Application class in the root package and enforce the Controller to Service to Repository flow.

Should I use constructor injection or field injection in Spring Boot?▼

Use constructor injection, preferably with Lombok @RequiredArgsConstructor and final fields. Field injection with @Autowired hides dependencies, complicates testing, and prevents immutability, so it should be avoided.

What is the difference between @ConfigurationProperties and @Value in Spring?▼

@ConfigurationProperties binds a group of related properties into one validated class with a prefix, while @Value injects single values scattered across classes. Grouped properties avoid duplication and support validation annotations like @NotBlank.

Should I use application.yml or application.properties in Spring Boot?▼

Prefer application.yml because its hierarchical structure is easier to read for nested configuration. Combine it with ${ENV_VAR:default} placeholders for secrets and separate profile files like application-dev.yml and application-prod.yml.

Why should I avoid @Data on JPA entities with Lombok?▼

@Data generates equals, hashCode, and toString using all fields, which causes issues with JPA lazy loading and entity identity. Use @Getter, @Setter, and @EqualsAndHashCode(of = {"id"}) instead, and exclude sensitive fields from @ToString.

How do I prevent logging sensitive data in Spring Boot?▼

Use SLF4J with parameterized messages and never log passwords, tokens, or PII. Exclude sensitive fields from Lombok @ToString and choose appropriate log levels such as INFO for business events and DEBUG for diagnostic detail.