Languages
[Edit]
EN

Spring Boot - accept and return JSON / XML in REST controller (consumes and produces)

6 points
Created by:
Indira
499

@RequestMapping example

Edit

To make this POST request work, we need to add:

  1. consumes = MediaType.APPLICATION_JSON_VALUE
  2. produces = MediaType.APPLICATION_JSON_VALUE
  3. @ResponseBody

Second example:

See also this quesion:

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join