Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple @RequestMapping annotations (@GetMapping, etc) on a controller method #32043

Open
sbrannen opened this issue Jan 16, 2024 · 2 comments
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement

Comments

@sbrannen
Copy link
Member

sbrannen commented Jan 16, 2024

As a follow-up to #31962, we would like to investigate the feasibility of supporting multiple @RequestMapping annotations on a single handler method.

One idea is to merge attributes from multiple @RequestMapping annotations into a single RequestMappingInfo instance if they only differ by RequestMethod.

Another idea is to create one RequestMappingInfo per @RequestMapping annotation on a handler method and figure out how to rework our infrastructure to support multiple RequestMappingInfo instances for a single handler method.

We should also keep in mind that we may potentially decide to support multiple composed @RequestMapping annotations (e.g., @PostMapping and @PutMapping) on a single method without making @RequestMapping itself a @Repeatable annotation.

@sbrannen sbrannen added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jan 16, 2024
@sbrannen sbrannen added this to the 6.2.x milestone Jan 16, 2024
@jhoeller jhoeller added the type: enhancement A general enhancement label Jan 16, 2024
@sbrannen sbrannen added the status: pending-design-work Needs design work before any code can be developed label Feb 1, 2024
@bclozel bclozel changed the title Support multiple @RequestMapping annotations (@GetMapping, etc) on a controller method Support multiple @RequestMapping annotations (@GetMapping, etc) on a controller method Feb 14, 2024
@rstoyanchev
Copy link
Contributor

While taking a look at this, we should also consider the case of an @HttpExchange (now also supported for server side use) and @RequestMapping on the same method, see #32328.

@bclozel
Copy link
Member

bclozel commented Jul 29, 2024

We haven't made any progress on this and we're quite late in the 6.2 milestones to introduce such an important behavior change.

I also think that introducing such a change would probably require an "opt-in" configuration flag as this is a quite disruptive change. With this enabled, the web framework could potentially expose web endpoints that were not exposed previously (because ignored) and this could be hard for developers to track this change down. Given where the original issues and their background (#31962 and #32328), I don't think this should be treated as a feature widely requested by the community, or overall making sense with the existing model.

I'll move this back to 6.x backlog and I guess I'm not in favor of this feature overall.

@bclozel bclozel modified the milestones: 6.2.x, 6.x Backlog Jul 29, 2024
@jhoeller jhoeller modified the milestones: 6.x Backlog, General Backlog Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants