Skip to content

Support @RequestHeader and @RequestParam as meta-annotations #28950

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

Closed
efemoney opened this issue Aug 11, 2022 · 1 comment
Closed

Support @RequestHeader and @RequestParam as meta-annotations #28950

efemoney opened this issue Aug 11, 2022 · 1 comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@efemoney
Copy link

efemoney commented Aug 11, 2022

Affects: 5.3.18


Within my project, almost all endpoints receive the user-agent header like so:

@RequestHeader("User-Agent", defaultValue = "") userAgent: String,

I would like to reduce this declaration to the following:

@UserAgentHeader userAgent: String,

I think handler methods support meta annotations (via reading the docs of org.springframework.core.annotation.SynthesizingMethodParameter) but the annotations (RequestParam, RequestHeader etc) have an annotation target of only PARAMETER so cannot be used as meta annotations.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 11, 2022
@sbrannen
Copy link
Member

Closing as a duplicate of #21829.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2022
@sbrannen sbrannen added status: duplicate A duplicate of another issue in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 11, 2022
@sbrannen sbrannen changed the title Support RequestHeader|Param as meta-annotations Support @RequestHeader and @RequestParamas meta-annotations Aug 28, 2023
@sbrannen sbrannen changed the title Support @RequestHeader and @RequestParamas meta-annotations Support @RequestHeader and @RequestParam as meta-annotations Aug 28, 2023
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: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants