Back to Skills

spring-boot-web-api

verified

Spring Boot 4 REST API implementation patterns. Use when creating REST controllers, request validation, exception handlers with ProblemDetail (RFC 9457), API versioning, content negotiation, or WebFlux reactive endpoints. Covers @RestController patterns, Bean Validation 3.1, global error handling, and Jackson 3 configuration.

View on GitHub

Marketplace

arkhe-claude-plugins

joaquimscosta/arkhe-claude-plugins

Plugin

spring-boot

Repository

joaquimscosta/arkhe-claude-plugins
3stars

plugins/spring-boot/skills/spring-boot-web-api/SKILL.md

Last Verified

January 23, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/joaquimscosta/arkhe-claude-plugins/blob/main/plugins/spring-boot/skills/spring-boot-web-api/SKILL.md -a claude-code --skill spring-boot-web-api

Installation paths:

Claude
.claude/skills/spring-boot-web-api/
Powered by add-skill CLI

Instructions

# Spring Boot Web API Layer

REST API implementation patterns for Spring Boot 4 with Spring MVC and WebFlux.

## Technology Selection

| Choose | When |
|--------|------|
| **Spring MVC** | JPA/JDBC backend, simpler debugging, team knows imperative style |
| **Spring WebFlux** | High concurrency (10k+ connections), streaming, reactive DB (R2DBC) |

With Virtual Threads (Java 21+), MVC handles high concurrency without WebFlux complexity.

## Core Workflow

1. **Create controller** → `@RestController` with `@RequestMapping` base path
2. **Define endpoints** → `@GetMapping`, `@PostMapping`, etc.
3. **Add validation** → `@Valid` on request body, custom validators
4. **Handle exceptions** → `@RestControllerAdvice` with `ProblemDetail`
5. **Configure versioning** → Native API versioning (Spring Boot 4)

## Quick Patterns

See [EXAMPLES.md](EXAMPLES.md) for complete working examples including:
- **REST Controller** with CRUD operations and pagination (Java + Kotlin)
- **Request/Response DTOs** with Bean Validation 3.1
- **Global Exception Handler** using ProblemDetail (RFC 9457)
- **Native API Versioning** with header configuration
- **Jackson 3 Configuration** for custom serialization
- **Controller Testing** with @WebMvcTest

## Spring Boot 4 Specifics

- **Jackson 3** uses `tools.jackson` package (not `com.fasterxml.jackson`)
- **ProblemDetail** enabled by default: `spring.mvc.problemdetails.enabled=true`
- **API Versioning** via `version` attribute in mapping annotations
- **@MockitoBean** replaces `@MockBean` in tests
- **@HttpExchange** declarative HTTP clients (replaces RestTemplate patterns)
- **RestTestClient** new fluent API for testing REST endpoints

## @HttpExchange Declarative Client (Spring 7)

New declarative HTTP client interface (alternative to RestTemplate/WebClient):

```java
@HttpExchange(url = "/users", accept = "application/json")
public interface UserClient {

    @GetExchange("/{id}")
    User getUser(@PathVariable Long id);

    @PostExchange
    

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3918 chars