Skip to content

Supports annotating parameter annotations like @PathVariable on interface method [SPR-16110] #20658

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions