spring-projects / spring-projects/spring-framework

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

Open
#32,043 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: web status: pending-design-work type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the follow-up issue #31962 and the controller-mapping infrastructure described here. Compare merging differing RequestMethod attributes with creating multiple RequestMappingInfo instances, including support for composed annotations such as @PostMapping and @PutMapping. Done means establishing a feasible design and its implications for the mapping infrastructure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.