Skip to content

Spring REST

Data Binding

  • Data binding is the process of converting JSON to Java POJO and vice-versa
  • Also know as mapping, (de)serialization, (un)marshalling
  • Jackson Project performs the data binding https://github.com/FasterXML/jackson-databind
  • Jackson calls the appropriate getter/setter methods (it does not access fields directly)

Status Codes

  • 1XX: Informational
  • 2XX: Successful
  • 3XX: Redirection
  • 4XX: Client error
  • 5XX: Server error

Content-Type

  • MIME (Multipurpose Internet Mail-Extension)
  • text/html, text/json, text/xml, etc

Rest Controller

  • @RestController automatically maps json to pojo and vice-versa
  • Requires jackson dependency