Skip to content

When no API version is provided, static resources fail to load #36059

@ghoonch4

Description

@ghoonch4

I am experimenting with the API Versioning feature introduced in Spring 7.

I have an image file named foo.png under the resources/static directory.
However, when I try to access http://localhost:8080/foo.png in the browser, the image cannot be loaded.

In my case, the HandlerMappings are evaluated in the following order:

  1. RouterFunctionMapping (with ApiVersionStrategy)
  2. RequestMappingHandlerMapping (with ApiVersionStrategy)
  3. WelcomePageHandlerMapping
  4. BeanNameUrlHandlerMapping
  5. WelcomePageNotAcceptableHandlerMapping
  6. SimpleUrlHandlerMapping

I expect the image resource to be handled by SimpleUrlHandlerMapping. However, due to the ordering, the request fails earlier in the initApiVersion(HttpServletRequest) method of RouterFunctionMapping.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions