Support meta-annotations for org.springframework.web request annotations #30761
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: duplicate
A duplicate of another issue
Uh oh!
There was an error while loading. Please reload this page.
Affects: <Spring Framework version>
Hi there 👋 I'm a long time enjoyer of spring boot.
We use Spring Boot with
springdoc
,javax.validation
andswagger-parser
to manage our spring controllers, input validation and generate our OpenAPI specification with great success. However using all of these tools has led to an accumulation of annotations on our controllers, their methods, and their parameters. This is becoming fragile with copypasta.Use Case
We want to unify our pagination across our controllers. Currently routes that paginate will accept the following params:
We have the same code-segments in many methods and controllers. While this is very powerful for us with our spring controller wiring and openapi spec generation, we hope to reduce the copy-pasta and enhance consistency with meta-annotations that can apply all of these common annotation patterns for us:
this could be possible with an annotation class, however:
the @RequestParam annotation only targets parameters, and so
This annotation is not applicable to target 'annotation class'
.Possible Solution
If spring framework request annotations could also support targeting
ANNOTATION_TYPE
, they could be used in kotlin annotation classes, and we would have a solution to unify our spring pagination controls nicely.As a poweruser of spring boot web annotations, I want the following annotations updated with support for
ANNOTATION_TYPE
targeting, so I can use them with other parameter annotations:@PathVariable
@RequestParam
@RequestMapping
@RequestBody
@RequestHeader
The text was updated successfully, but these errors were encountered: