Skip to content

Comments

Add Spring Framework 7 API Versioning pattern to enterprise category#63

Merged
brunoborges merged 3 commits intomainfrom
copilot/add-api-versioning-support
Feb 20, 2026
Merged

Add Spring Framework 7 API Versioning pattern to enterprise category#63
brunoborges merged 3 commits intomainfrom
copilot/add-api-versioning-support

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Spring Framework 7 introduced native API versioning, eliminating the need to duplicate controller classes per version. This adds a new enterprise pattern demonstrating the before/after.

Changes

  • content/enterprise/spring-api-versioning.json — new pattern (ID 110) contrasting manual URL-path versioning (separate V1/V2 controller classes) against Spring Framework 7's version attribute on @GetMapping with centralized configureApiVersioning() strategy
  • content/enterprise/jdbc-resultset-vs-jpa-criteria.json — updated next pointer to enterprise/spring-api-versioning to maintain navigation chain

Example

Before — duplicated controller per version:

@RestController @RequestMapping("/api/v1/products")
public class ProductControllerV1 { ... }

@RestController @RequestMapping("/api/v2/products")
public class ProductControllerV2 { ... }

After — single controller, version per method:

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void configureApiVersioning(ApiVersionConfigurer config) {
        config.useRequestHeader("X-API-Version");
    }
}

@RestController @RequestMapping("/api/products")
public class ProductController {
    @GetMapping(value = "/{id}", version = "1")
    public ProductDtoV1 getV1(@PathVariable Long id) { ... }

    @GetMapping(value = "/{id}", version = "2")
    public ProductDtoV2 getV2(@PathVariable Long id) { ... }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Spring Framework 7 API Versioning</issue_title>
<issue_description>Spring Framework version 7 now has support for API versioning. Before, developers had to manually implement. Let's add a slug for this under enterprise category</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add slug for API versioning in Spring Framework 7 Add Spring Framework 7 API Versioning pattern to enterprise category Feb 20, 2026
Copilot AI requested a review from brunoborges February 20, 2026 08:00
@brunoborges brunoborges marked this pull request as ready for review February 20, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spring Framework 7 API Versioning

2 participants