Skip to content

Apply path api version resolver last#50125

Open
barry3406 wants to merge 1 commit intospring-projects:mainfrom
barry3406:fix/api-versioning-path-last
Open

Apply path api version resolver last#50125
barry3406 wants to merge 1 commit intospring-projects:mainfrom
barry3406:fix/api-versioning-path-last

Conversation

@barry3406
Copy link
Copy Markdown

PathApiVersionResolver never returns null (as documented on the resolver itself), so any resolvers registered after it in DefaultApiVersionStrategy are unreachable. Because configureApiVersioningUse currently binds path-segment before media-type-parameter, configuring both causes the media-type (and any later bean-supplied) resolver to be skipped.

This moves the path-segment binding to the end of configureApiVersioningUse in both WebMvcAutoConfiguration and WebFluxAutoConfiguration so that the non-yielding path resolver is always consulted last. Tests are added that combine path-segment with media-type-parameter and assert the media-type resolver still resolves.

Closes gh-49800

PathApiVersionResolver never returns null, so any resolvers registered
after it in DefaultApiVersionStrategy are unreachable. Register the
path-segment resolver last in configureApiVersioningUse so the header,
query-parameter and media-type-parameter resolvers still run when
path-segment is also configured.

Closes spring-projectsgh-49800
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API versioning path strategy should be applied path last as it is not meant to yield

2 participants