← スキル一覧に戻る

spring-boot
by dallay
⭐ 1🍴 0📅 2026年1月23日
SKILL.md
name: spring-boot description: > Spring Boot with WebFlux, R2DBC, and reactive patterns for Kotlin. Trigger: When working with controllers, services, repositories, or Spring configuration. allowed-tools: Read, Edit, Write, Glob, Grep, Bash metadata: author: cvix version: "2.0"
Spring Boot Skill
Conventions for Spring Boot backend development with WebFlux, R2DBC, and Kotlin.
Architecture Note: This skill covers the Infrastructure Layer of our Hexagonal Architecture. For domain models, use cases, and overall feature organization, see the hexagonal-architecture skill.
Layer Context
| Layer | What Goes Here | Spring Annotations? |
|---|---|---|
| Domain | Entities, Value Objects, Repository interfaces | NO |
| Application | Commands, Queries, Handlers, Use Case services | NO |
| Infrastructure (this skill) | Controllers, R2DBC repos, Configs, Adapters | YES |
When to Use
- Creating REST controllers (HTTP adapters)
- Implementing repository adapters (R2DBC implementations)
- Configuring Spring Security, CORS, caching
- Wiring application services as Spring beans
- Writing integration tests with Testcontainers
Quick Reference
Controllers & HTTP Layer
Thin HTTP adapters that delegate to application handlers. No business logic.
- Controllers -
@RestController, routing, OpenAPI annotations - Request/Response DTOs - Jakarta validation, Schema annotations
- Swagger Standard - OpenAPI documentation conventions
Application Layer Wiring
Application services are framework-agnostic; Spring wires them via @Configuration.
- CQRS Handlers - Command/Query handlers as
@Servicebeans
Persistence Layer
Repository adapters implementing domain ports with R2DBC.
- Repositories - Domain ports, Spring Data interfaces, adapters
- Entities & Mappers -
@Tableentities, mapper components
Cross-Cutting Concerns
- Error Handling -
@ControllerAdvice, ProblemDetail (RFC 7807) - Configuration -
@ConfigurationProperties, Security, R2DBC - WebFlux & Coroutines - Reactive patterns, never block
HTTP Status Codes
| Code | When to Use |
|---|---|
200 OK | Successful GET, PUT |
201 Created | Successful POST that creates resource |
204 No Content | Successful DELETE |
400 Bad Request | Invalid input, malformed JSON |
401 Unauthorized | Missing or invalid auth |
403 Forbidden | Valid auth but insufficient permissions |
404 Not Found | Resource doesn't exist |
409 Conflict | State conflict (duplicate email, etc.) |
422 Unprocessable Entity | Valid syntax but semantic errors |
500 Internal Server Error | Unexpected server errors |
Application Profiles
| Profile | Purpose |
|---|---|
dev | Local development, verbose logging, H2/Testcontainers |
test | Automated tests, mocked external services |
staging | Production-like, real services |
prod | Production, optimized settings, real databases |
Anti-Patterns
| Anti-Pattern | Why It's Wrong |
|---|---|
| Spring annotations in Application/Domain | Only Infrastructure has Spring dependencies |
| Business logic in controllers | Controllers delegate to application handlers |
| Exposing entities in API | Use DTOs (Request/Response classes) |
block() in WebFlux | Use coroutines or reactive operators |
| Generic exception catching | Handle specific exceptions with proper responses |
| Secrets in code | Use environment variables or secret managers |
| Domain ports extending Spring interfaces | Domain ports are pure Kotlin; adapters use Spring |
See WebFlux & Coroutines for reactive anti-patterns.
Commands
# Run application
./gradlew bootRun
# Run with profile
SPRING_PROFILES_ACTIVE=dev ./gradlew bootRun
# Run tests
./gradlew test
# Integration tests only
./gradlew test -PincludeTags=integration
# Build JAR
./gradlew bootJar
Resources
Internal References
- Controllers - HTTP adapter patterns
- CQRS Handlers - Command/Query handler wiring
- Repositories - R2DBC repository adapters
- Entities & Mappers - Persistence entities
- Configuration - Spring configuration patterns
- Error Handling - Exception handling with ProblemDetail
- WebFlux & Coroutines - Reactive patterns
- Request/Response DTOs - API contracts
- Swagger Standard - OpenAPI documentation
Related Skills
- hexagonal-architecture - Domain, Application layers & feature organization
- kotlin - Kotlin conventions for all layers
External Documentation
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です