Consumes
Learn Consumes (Controllers, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Fresher Notes consumes is a mapping condition that limits a handler to requests whose Content-Type header matches, such as consumes = "application/json" . Purpose : pick the right method for the body format the client sends, for example JSON versus XML versus form data. Mismatch : a request with another content type gets 415 Unsupported Media Type .
More lessons in Controllers
- @Controller
- @RestController
- Controller Lifecycle
- Controller Methods
- Request Mapping
- @RequestMapping
- @GetMapping
- @PostMapping
- @PutMapping
- @DeleteMapping
- @PatchMapping
- Mapping HTTP Methods
- Mapping URL Paths
- Class-Level Mapping
- Method-Level Mapping
- Multiple URL Mappings
- Produces
- Mini Project: Controller Types and Mapping Rules