Closed
Description
Yanming Zhou opened SPR-16110 and commented
public interface EchoService {
@RequestMapping(value = "/echo/{name}", method = RequestMethod.POST)
public String echo(@PathVariable String name);
}
@RestController
public class EchoServiceImpl implements EchoService {
public String echo(String name) {
return name;
}
}
My motivation:
I need annotating @PathVariable
and other parameter annotations in interface to create client proxy.
My proposal:
Improve org.springframework.core.MethodParameter to find annotation like AnnotatedElementUtils.findMergedAnnotation() which used by method level annotation like @RequestMapping
. If it has side effects, improve RequestResponseBodyMethodProcessor and AbstractNamedValueMethodArgumentResolver directly.
My workaround:
Duplicate Parameter annotations on concrete controller method.
Issue Links:
- Enable REST controller method parameter annotations on an interface [SPR-11055] #15682 Enable REST controller method parameter annotations on an interface ("duplicates")
- @RequestBody annotation in interface is ignored [SPR-15714] #20270
@RequestBody
annotation in interface is ignored