Closed
Description
Sérgio Vale e Pace opened SPR-12296 and commented
Support creating annotations with @RequestMapping
meta-annotation like it is possible to do with the @Component
annotation.
For instance, I would like to create an annotation @PostJson
that would replace a @RequestMapping
with parameters:
@RequestMapping(
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE
consumes = MediaType.APPLICATION_JSON_VALUE)
public @interface PostJson {
String value() default "";
}
So I could write:
@PostJson("/input")
public Output myMethod(Input input) {
instead of:
@RequestMapping(value = "/input",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public Output myMethod(Input input) {
Affects: 4.1.1
Reference URL: http://stackoverflow.com/questions/26049810/create-annotation-setting-requestmapping-parameters-using-spring-mvc/26050717#26050717
Issue Links:
- AnnotatedElementUtils fails to find annotations on abstract, bridge, or interface methods [SPR-12738] #17335 AnnotatedElementUtils fails to find annotations on abstract, bridge, or interface methods ("depends on")
- Introduce unified support for declaring and looking up annotation attribute aliases [SPR-11512] #16137 Introduce unified support for declaring and looking up annotation attribute aliases ("depends on")
- Introduce a comprehensive programming model for meta-annotation support [SPR-11511] #16136 Introduce a comprehensive programming model for meta-annotation support
- Introduce predefined composed annotations in core Spring [SPR-13442] #18022 Introduce predefined composed annotations in core Spring
- Introduce common composed annotations for @RequestMapping [SPR-13992] #18565 Introduce common composed annotations for
@RequestMapping
1 votes, 6 watchers