@PathVariable, @RequestParam, @RequestBody

Spring binds request data to method parameters: @PathVariable reads a path variable (/clients/{id}), @RequestParam a query parameter (?page=2), and @RequestBody the body, deserialized from JSON. Validation is combined with @Valid.

Example

@GetMapping("/clients/{id}")
Client un(@PathVariable long id, @RequestParam(defaultValue = "fr") String langue) {...}

Related concepts

The whole glossary