Skip to content

mvc Parameter annotations are not inherited [SPR-14526] #19095

Closed

Description

@spring-projects-issues

Terence Mill opened SPR-14526 and commented

 @RequestMapping(method = RequestMethod.GET, value = "/{userId}", produces = "application/json", consumes = "application/json")
public IUser getUserById(@PathVariable("userId") Long userId);

Calling @Get on PROT://DOMAIN/users/1 -> userId is NULL :(

@RequestMapping("/users") public interface IUserEndpoint {..} 
@RestController public class UserEndpoint extends implements IUserEndpoint {..}

(!) It only works if i repeat @PathVariable in my implementing @RestController

@RestController public class UserEndpoint extends implements IUserEndpoint {
public IUser getUserById(@PathVariable("userId") Long userId);

Repeating the REST contract is an ugly workaround


Affects: 4.2.6

Issue Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

status: duplicate

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions