agentleFS
rrezartprebrezarrezartprebreza/spring-boot-skills/skills/spring-boot-4/api-versioning/SKILL.md

api-versioning

Skill344 starsChanged 3 months agoMITView on GitHub

Use when versioning Spring MVC or WebFlux APIs in Spring Boot 4 / Spring Framework 7. Covers built-in mapping versions, request version resolution, defaults, supported versions, and deprecation headers.

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use dependency-injection, openapi and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • HamzaSheikh768Skill

    dependency-injection

    Leverages FastAPI's powerful Depends system for reusable authentication, database sessions, rate limiting, and business logic injection.

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    openapi

    OpenAPI/Swagger specification and documentation

    Also in 3 projects that use this

  • diego-tobalinaSkill

    logging

    Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.

    Also in 3 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use semantic version strings.

    line 29

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API Versioning (Boot 4 / Framework 7)

Spring Framework 7 provides API versioning in the mapping layer. Prefer it over hand-rolled /v1 prefixes, custom HandlerMapping implementations, or version-sniffing filters.

Declare versions on mappings

@RestController
@RequestMapping("/api/orders")
class OrderController {

    @GetMapping(path = "/{id}", version = "1.0")
    OrderV1 getV1(@PathVariable UUID id) { ... }

    @GetMapping(path = "/{id}", version = "1.2")
    OrderV2 getV2(@PathVariable UUID id) { ... }
}

Use semantic version strings. A + suffix means the mapping handles that version and newer versions, for example version = "1.2+".

Configure one request resolution strategy

@Configuration
class WebConfig implements WebMvcConfigurer {
    @Override
    public void configureApiVersioning(ApiVersionConfigurer configurer) {
        configurer
            .useRequestHeader("API-Version")
            .setDefaultVersion("1.0")
            .addSupportedVersions("1.0", "1.2");
    }
}

Choose exactly one source: request header, query parameter, path segment, or media-type parameter. Keep the choice consistent across the application. WebFlux uses the corresponding WebFluxConfigurer hook.

Required behavior and deprecation

Versioning is required unless a default is configured or setVersionRequired(false) is used. Missing or unsupported versions should be covered by the API error contract. Use StandardApiVersionDeprecationHandler for Deprecation, Sunset, and Link response headers.

Boot properties can provide defaults under spring.mvc.apiversion.* or spring.webflux.apiversion.*, but keep the resolution strategy in Java configuration when its behavior must be explicit.

Gotchas

  • Agent hand-rolls /api/v1 prefixes or a version filter - use the mapping version attribute.
  • Agent writes version = 1 - the value is a semantic version String, such as "1.0".
  • Agent uses useHeader or useQueryParameter - use useRequestHeader or useQueryParam.
  • Agent enables versioning without a default or versionRequired(false) - un-versioned requests return 400.
  • Agent mixes a path segment and a request header - choose one source of truth.
  • Agent invents custom sunset headers - use StandardApiVersionDeprecationHandler.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.