Component: WebMvcAutoConfiguration.configureApiVersioningUse()
Issue: PathApiVersionResolver never returns null (as stated in its own Javadoc), so any resolvers added after it in the list are unreachable. Currently the media-type parameter resolver is added after the path-segment resolver.
Fix: Move map.from(use::getPathSegment).to(configurer::usePathSegment) to the end of the method, after the media-type parameter registration.
The following config will show the issue when the request is trying to use the media type to supply the API Version. Instead of trying the media type param resolver is tries the path resolver and then ends before trying the media type param resolve.
spring:
mvc:
api-version:
supported:
- "1.0"
use:
header: "X-API-Version"
query-parameter: "api-version"
media-type-parameter:
"[application/json]": "version"
"[application/vnd.resource+json]": "version"
path-segment: 0
Component:
WebMvcAutoConfiguration.configureApiVersioningUse()Issue:
PathApiVersionResolvernever returns null (as stated in its own Javadoc), so any resolvers added after it in the list are unreachable. Currently the media-type parameter resolver is added after the path-segment resolver.Fix: Move
map.from(use::getPathSegment).to(configurer::usePathSegment)to the end of the method, after the media-type parameter registration.The following config will show the issue when the request is trying to use the media type to supply the API Version. Instead of trying the media type param resolver is tries the path resolver and then ends before trying the media type param resolve.