Skip to content

Caching of ProducesRequestCondition in EndpointHandlerMapping may break custom HandlerMapping or ContentTypeResolver arrangements #20150

@ykoyano

Description

@ykoyano

Due to the optimization of ProducesRequestCondition, HandlerMapping caches MediaTypesAttribute.
However, WebFluxEndpointHandlerMapping and CloudFoundryWebFluxEndpointHandlerMapping do not delete the cached MediaTypesAttribute and affect the resolution of MediaTypes of other HandlerMappings. ( On the other hand, the class that inherits RequestMappingHandlerMapping deletes the cache.)

These issues are occurring not only in Spring Webflux's HandlerMapping but also in Spring MVC's HandlerMapping.

To solve this problem, I think you need one of the following measures:
Add a process to delete the cache at the end of HandlerMapping to AbstractWebFluxEndpointHandlerMapping and AbstractWebMvcEndpointHandlerMapping.
Move the process of deleting the cache at the end of HandlerMapping from RequestMappingHandlerMapping to RequestMappingInfoHandlerMapping of the parent class.

If my proposed solution is correct, I am ready to create a PR.

Related URL

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions