Spring Boot receives annotations for a single String type parameter

Use of @PathVariable() parameter passing annotation

(Receive parameters of type Long and type String ) Example:


@RestController
@RequestMapping("/api")
public class Controller {

    @Autowired
    private IUserService userService;

    @PostMapping("/getlist/{id}/{name}")
    private AjaxResult getlist(@PathVariable("id") Long id,
                               @PathVariable("name") String name) {
        List<user> list= userService.getlist(id, name);
        return AjaxResult.success(list);
    }

}

Guess you like

Origin blog.csdn.net/qq_61726905/article/details/126890119