Important Interview Question of Spring Annotation : Difference between @RequestBody & @ResponseBody

Описание к видео Important Interview Question of Spring Annotation : Difference between @RequestBody & @ResponseBody

#Spring #RequestBody #Vs #ResponseBody

► SUBSCRIBE & LIKE!!

► Important Information and code guide available bottom of the Description section

► Official Email Id: [email protected]
► Download the sample java microservice application :
https://github.com/admindebu/In-Memor...
► Follow on Facebook:   / techtalkdebu  
► Follow on LinkedIn:   / debu-paul  

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
► Here is our amazing playlist for Core Java, Spring MVC/Boot, Git and Microservice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Core Java :: https://www.youtube.com/watch?v=IR_h0...
2. Core Java Important Interview QA : https://www.youtube.com/watch?v=CFoxr...
3. Spring MVC & Spring Boot :: https://www.youtube.com/watch?v=f-Wk1...
4. Micro Services :: https://www.youtube.com/watch?v=pscya...
5. Git/GitHub :: https://www.youtube.com/watch?v=XHxBA...
6. AWS :: https://www.youtube.com/watch?v=81Y_2...
7. Spring Security & OAuth : https://www.youtube.com/watch?v=AvV8l...
8. Coding and Programming : https://www.youtube.com/watch?v=o2BP4...
9. Raspberry PI & Arduino : https://www.youtube.com/watch?v=uauMF...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Watch my "Most Watched Videos"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
► HTTPS & HTTPS protocol :: https://www.youtube.com/watch?v=BlnSS...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@RequestBody and @ResponseBody annotations are used to bind the HTTP request/response body with a domain object in method parameter or return type. Behind the scenes, these annotation uses HTTP Message converters to convert the body of HTTP request/response to domain objects.

The @ResponseBody annotation means that the result returned by this method is directly written into the Http response body, which is generally used when obtaining data asynchronously; after using @RequestMapping, the return value is usually parsed as a jump path, and the return value will not be changed after adding @ResponseBody It is parsed as a jump path, but written directly into the HTTP response body. For example, to obtain Json data asynchronously, plus @ResponseBody, Json data can be returned directly.

The @RequestBody annotation inserts the Http request body into the method, and uses the appropriate HttpMessageCoverter to write the request body into an object

The job of @Controller is to create a Map of the model object and find a view but @RestController simply returns the object and object data is directly written into HTTP response as JSON or XML.
@Controller since Spring 2.5 Officially (3, 3.1) and @RestController Spring 4
@Controller is a common or generic annotation that is used to mark a class as Spring MVC Controller (web controller) while @RestController is a special controller used in RestFull Webservice API and the equivalent of
@RestController = @Controller + @ResponseBody
@Controller is a stereotype annotation or it’s specialization of @Component annotation, while @RestController is a specialization of @Controller annotation
@RestController and @Controller is that you don't need to use @ResponseBody on every handler method once you annotate the class with @RestController
Controller and @RestCotroller in Spring MVC is that once you mark a class @RestController then every method is written a domain object instead of a view.

GitHub Account for Free Code download: https://github.com/admindebu
Follow me on FaceBook:   / techtalkdebu  
Instagram: techtalk_debu
LinkedIn :   / debu-paul  

if you like my video, please subscribe to my channel and share the video

Thanks & Regards,
Debu Paul

Комментарии

Информация по комментариям в разработке