Skip to content

Inconsistent interpretation of parameter annotations in interface-based handler methods [SPR-14021] #18593

Closed
@spring-projects-issues

Description

@spring-projects-issues

Paul opened SPR-14021 and commented

If I have Spring MVC interface with methods, whose params are annotated with different param types like this:

public interface PersonAPIEndpoint {
  @RequestMapping(
      path = "/person/{username}/",
      method = RequestMethod.GET
  )
  DeferredResult<PersonWithOrganizationalUnitsDTO> loadUserByUsername(@PathVariable("username") String username);

  @RequestMapping(
      path = "/person",
      method = RequestMethod.GET
  )
  DeferredResult<DataPage<PersonDTO>> listPersons(@RequestParam("pageNum") int pageNum, @RequestParam("pageSize") int pageSize, @RequestParam(value = "query", required = false) String query);

and class, which is derived from this interface, but arguments of methods are not annotated with Param annotations mapper behaviour is inconsistent:
values, annotated with @RequestParam get their values in implementing class, and with @PathVariable — not.


Issue Links:

Referenced from: commits spring-attic/spring-framework-issues@bfbb943, spring-attic/spring-framework-issues@de6f178

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions