@RequestMapping(value = "/get/{id}/{userId}", method = RequestMethod.GET) public Result getMemberShip(@PathVariable("id") int id,@PathVariable("userId") int userId) {
If id is a non-required parameter
// You can specify multiple matching paths @RequestMapping(value = {"/get/{userId}", "/get/{id}/{userId}"}, method = RequestMethod.GET) // Then set parameters are not required @PathVariable(required = false ) String id