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 @RequestParam and @RequestHeader as meta-annotations [SPR-17296] #21829

Open
spring-issuemaster opened this issue Sep 22, 2018 · 2 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 22, 2018

Rob Winch opened SPR-17296 and commented

It would be nice if @RequestHeader could be used for a meta-annotation. This would make it easier if a header was being used consistently throughout the entire application. For example, a user might do something like this:

@Retention(RetentionPolicy.RUNTIME)
@RequestHeader(name = "user-id")
public @interface CurrentUserId {
}

No further details from SPR-17296

@joehitt

This comment has been minimized.

Copy link

@joehitt joehitt commented Nov 19, 2019

Please consider also doing this for @RequestParam, so same can be done for commonly-reused request parameters. A common use case would be page number and page size for Pageable REST services:

@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@RequestParam(name = "page", required = false)  //  currently "not applicable to annotation type"
public @interface PageNumber {
}
@sbrannen sbrannen changed the title Support for @RequestHeader as meta annotation [SPR-17296] Support @RequestParam and @RequestHeader as meta-annotations [SPR-17296] Nov 20, 2019
@sbrannen sbrannen modified the milestones: 5.x Backlog, 5.3 M1 Nov 20, 2019
@sbrannen

This comment has been minimized.

Copy link
Member

@sbrannen sbrannen commented Nov 20, 2019

Currently slated for 5.3.

We will need to assess whether such changes need to be applied to additional controller method argument annotations as well.

It may be sufficient to switch from MethodParameter to SynthesizingMethodParameter for such annotation lookups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.