Skip to main content

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