Тёмный

Springboot @Controller | @RestController | @ResponseBody | @ResponseEntity | rest api | okay java 

okay java
Подписаться 6 тыс.
Просмотров 10 тыс.
50% 1

Springboot @Controller | @RestController | @ResponseBody | @ResponseEntity | rest api | okay java
Buy me a coffee - www.buymeacoff...
what is the difference between a REST API and a web application. ??
Response from a web application is generally view (HTML + CSS) because they are intended for human viewers.
REST API just returns data in form of JSON or XML because most of the REST clients are programs.
@Controller annotation
Used to mark a class as Spring MVC Controller.
To handle web request
Returns “view” (html response with model values)
Spring 2.5
@RestController annotation
@Controller + @ResponseBody.
To handle rest api request
Returns JSON/XML response
Spring 4.0
@ResponseBody annotation
Converts object into json format
To put this in simple words, @ResponseBody tell Spring framework to serialize a return object into JSON or XML and send this information back as part of the HTTPResponse.
Summary
@Controller create a Map of Model Object and find a view while @RestController simply return object and object data directly written into http response as JSON orXML.
The @RestController annotation in Spring MVC/Spring BOOT is nothing but a combination of @Controller and @ResponseBody annotation.
The key difference is that you do not need to use @ResponseBody on each and every handler method once you annotate the class with @RestController.

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 17   
@govardhanindian
@govardhanindian Год назад
I have seen lots videos but only your video is best...................
@kartikkatwal9729
@kartikkatwal9729 2 года назад
beautifully explained, for the same topic i saw many videos but your video make me understood this concept well.
@okayjava
@okayjava 2 года назад
Thanks for liking
@kidanehailemichael9203
@kidanehailemichael9203 2 года назад
Amazing explanation. Thank you
@okayjava
@okayjava 2 года назад
Glad it was helpful!
@learnjava-u7z
@learnjava-u7z Год назад
seriously I have got what i am looking for the best one just awesome
@beizhou1614
@beizhou1614 Год назад
This is so well taught! Thank you so much.
@arpankumarkar4895
@arpankumarkar4895 2 года назад
Really such a creative explanation 🔥. I have seen lots videos but only your video is best.
@okayjava
@okayjava 2 года назад
Glad you liked it
@sowndaryaravi643
@sowndaryaravi643 9 месяцев назад
Very clear 👌
@vaishnavi_cholli
@vaishnavi_cholli 2 года назад
Good Explanation
@okayjava
@okayjava 2 года назад
Thank you 😊
@ritspatil163
@ritspatil163 2 года назад
Great explanation.. Pls make on respond entity
@saiv5768
@saiv5768 2 года назад
Excellent!!Excellent
@okayjava
@okayjava 2 года назад
Thank you 😊
@MrMDanny
@MrMDanny 2 года назад
sir you are the best
@okayjava
@okayjava 2 года назад
You are awesome ✌
Далее
Слушали бы такое на повторе?
01:00
Wildest 10 SECONDS OF HIS LIFE 🤯 @TomIsted
00:14
Просмотров 1,4 млн
Microservices using SpringBoot 3.0 | Full Example [NEW]
1:25:38