Spring Boot Request Body | Rest Controller | Rest API

Published: 19 February 2022
on channel: Senol Atac
675
7

Hi guys,

In this lesson, we will talk about the spring request body.

Spring provides a RequestBody annotation for rest api.

the @RequestBody annotation maps the HttpRequest body to a transfer or domain object, enabling automatic deserialization of the inbound HttpRequest body onto a Java object.

If a method parameter is annotated with @RequestBody, Spring will bind the incoming HTTP request body to that parameter. While doing that, Spring will use HTTP Message converters to convert the HTTP request body into domain object.

Spring provides many default HttpMessageConverters, which will be used for conversion, depending on the presence of a certain library in project classpath.
Of course, we can use different content types in spring like json, xml etc.
For example, if the Content-Type in request Header is application/json , that means the POST body contains json, and if Jackson library is found in your classpath, Spring will delegate the conversion to JacksonHttpMessageConverter [for json].
We will see the details of it on our project.
That’s all for the beginning.
Thank you.


Watch video Spring Boot Request Body | Rest Controller | Rest API online without registration, duration hours minute second in high quality. This video was added by user Senol Atac 19 February 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 675 once and liked it 7 people.