Тёмный

A First Look at the new Rest Client in Spring Boot 3.2 

Dan Vega
Подписаться 57 тыс.
Просмотров 26 тыс.
50% 1

This is my first look at the new Rest Client in Spring Boot 3.2. In this tutorial we will discuss what a client is, what are the different implementations of clients available and how to get started with the new Rest Client in Spring Framework 6.1 and Spring Boot 3.2
🔗Resources & Links mentioned in this video:
GitHub Repo: github.com/danvega/rest-client
Http Interfaces: • Spring HTTP Interface ...
👋🏻Connect with me:
Website: www.danvega.dev
Twitter: / therealdanvega
Github: github.com/danvega
LinkedIn: / danvega
Newsletter: www.danvega.dev/newsletter
SUBSCRIBE TO MY CHANNEL: bit.ly/2re4GH0 ❤️

Наука

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

 

7 сен 2023

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@hayrullahyasar
@hayrullahyasar 10 месяцев назад
Thank you for sharing. I like the new Rest Client.
@svalyavasvalyava9867
@svalyavasvalyava9867 10 месяцев назад
Awesome video, thank you ☺️
@sumitghatule713
@sumitghatule713 10 месяцев назад
Thank you for sharing.
@avdain
@avdain 10 месяцев назад
Super excited for this feature! 🙌🏼
@DanVega
@DanVega 10 месяцев назад
Me too!
@AleksandarT10
@AleksandarT10 10 месяцев назад
We need a new JdbcClient video as well!. Anyway the ParametrizedTypeReference stuff is lame a bit to write it still.
@DanVega
@DanVega 10 месяцев назад
Recording today!
@janetkalu3064
@janetkalu3064 10 месяцев назад
Thank you so much, you are a gem
@arghyamitra3281
@arghyamitra3281 10 месяцев назад
That's true still we r using parameterisedTypeReference , it could have been better if just toList() kind of method and let compiler figure out the type
@M_Jaggard
@M_Jaggard 10 месяцев назад
Sadly while the compiler can figure out the type, it doesn't give that info to the method so there's no way at runtime for it to know how to create the individual objects. Having said that, turning something into a List is SUCH a common thing to do that ``".bodyToListOf(Post.class)" or similar would be useful.
@Anbu_Sampath
@Anbu_Sampath 10 месяцев назад
RestClient with Declarative Interface client is nice combo.
@AmandeepSingh-hd8iq
@AmandeepSingh-hd8iq 9 месяцев назад
Awesome video Dan. Love watching your live demos. As a side question: what theme is it? It's so elegant.
@shantohossain1372
@shantohossain1372 10 месяцев назад
i love this one
@hkkabir2024
@hkkabir2024 9 месяцев назад
never used restclient, used resttemplate before so i will try this now.
@VerhoevenSimon
@VerhoevenSimon 10 месяцев назад
I really like the enhancements, now to hopefully get a more elegant solution for ParametrizedTypeReference in a future release.
@IvanRandomDude
@IvanRandomDude 10 месяцев назад
It's just a limitation of Java.
@the00one45
@the00one45 10 месяцев назад
Great video! Does the new rest client have a more convenient way to handle concurrent requests than the rest template? One big advantage of the web client compared to the rest template for me was that successive calls can be handled a lot quicker because they dont have to wait for another.
@traxex1975
@traxex1975 10 месяцев назад
With HTTP Interface in place, since you replaced PostService with it, you could remove PostService at the end 😊
@awjamesfrj
@awjamesfrj 10 месяцев назад
Very good info! How does rest client deals when the external service is unavailable or returns some error? Does rest client support circuit breaker handling?
@EltonBragaSilva
@EltonBragaSilva 6 месяцев назад
Great content Dan. Thanks for posting this video. One question, I used to use FeignClient and we have I way to log all the request, response, urls, headers, etc. Do you have any idea how we can do the same with RestClient?
@harshsingh8175
@harshsingh8175 9 месяцев назад
Hello Dan, Thanks for wonderfull video, Can you make one video on aws lamda for spring boot database access whether to use orm like hibernate or spring data jpa or spring JDBC which one is best suited
@rioberliandinatamunas2454
@rioberliandinatamunas2454 9 месяцев назад
Hi Dan, Thats awesome 👍 Would you like to make a vidoe about how to setup and solve comon issue with hikari?
@nathanlively
@nathanlively 10 месяцев назад
Hi Dan, perfect timing on this. I wasn't able to get the default header to work, but I did get this to work: ResponseEntity response = restClient.post() .uri("/contacts?email={email}&first_name={first_name}&lists[]={listId}", email, firstName, listId) .header("Authorization", "Bearer " + token) .contentType(MediaType.APPLICATION_FORM_URLENCODED) .retrieve() .toBodilessEntity();
@andytael
@andytael 9 месяцев назад
Really cool! Do you know if this new shiny thing has Eureka discovery built in and if that's the case is the authentication stuff passed to the discovered service. Reason for asking, I'm using feign today to call other services (and Eureka) but auth is not passed when using Feign which can be solved uisng an interceptor but it's clunky. I'd rather see that the Rest Client have this built in :-)
@nickphilippe9743
@nickphilippe9743 10 месяцев назад
What are the main differences between Rest Client and the Feign client (or Spring Cloud OpenFeign) ? Are there scenario's where one is preferred over the other?
@glebivashyn5962
@glebivashyn5962 7 месяцев назад
I was actually wondering the same. Would be really cool to see a video diving into comparison of those
@traxex1975
@traxex1975 10 месяцев назад
Is there a way to remove Post record also, or we have to have it with the same structure as on remote REST endpoints that you call with RestClient? (Bc of that body to entity mapping)
@hamednikbakht9708
@hamednikbakht9708 10 месяцев назад
how to send token for this
@user-un1um2vf3y
@user-un1um2vf3y 9 месяцев назад
bro, thanks for video. but what about errorHandler, restTemplate had amazing option as ResponseErrorHandler, may be restClient has similar option too?
@rickhunter8216
@rickhunter8216 10 месяцев назад
NICE T-SHIRT
@user-hn1hn1kn5k
@user-hn1hn1kn5k 5 месяцев назад
Cool, thanks! What about (1) proxies (2) SSL (self-signed, enterprise CA, ...) (3) error handling ?
@rahuldebnath3919
@rahuldebnath3919 6 месяцев назад
How to configure RestClient with OAuth2 to call protected endpoints
@peshutanpavri1599
@peshutanpavri1599 5 месяцев назад
Hey this is great, so if I wanted to do an Integrated test with @SpringBootTest, I could just use this client directly right ?
@Radhad85
@Radhad85 6 месяцев назад
I have 2 issues using RestClient with Spring Boot 3.2. First one is in the builder I set a baseUrl bit I have to prepend the baseUrl on every get() or post() request but I don't know why - makes no sense to me. The other thing is, when I compile a native build, the application cannot find a HttpMessageConverter for my request object which should be converted to JSON. This works finde with Java 21 but not compiled to a native application. Does anyone know why?
@loic.bertrand
@loic.bertrand Месяц назад
Is there a way to disable SSL verification on the RestClient? Like the TrustAllStrategy for the SSLContext in Apache HttpClient (without having to use the HttpClient as a request factory for the RestClient)
@s3cario475
@s3cario475 5 месяцев назад
Hey, what's a plugin which help to copletly words?
@wagdynavas6337
@wagdynavas6337 10 месяцев назад
Do you recommend RestClient to make micro services calls?
@deepastephenson
@deepastephenson 10 месяцев назад
If there is an Authorisation token(oauth - Apigee) API call before the real API call how do we make 2 calls here? Also, if the Api calling is massl, can you show how to implement that with restclient
@azenkwed
@azenkwed 5 месяцев назад
I am getting a 405 Method not allowed for the methods POST, PUT and DELETE. Only the GET Methods work. Any idea?
@levis7085
@levis7085 10 месяцев назад
Does this provide any support to call APIs with Mtls?
@vernon_4411
@vernon_4411 6 месяцев назад
I might miss something. Is the RestClient built on top of OkHttp? The code syntax is almost the same as OkHttp.
@user-xo4hk2ir9l
@user-xo4hk2ir9l 8 месяцев назад
And Spring Feign client. Is it a good choice too? What is your opinion about? Thank you for the greate video o/
@aaaaaaa2913
@aaaaaaa2913 10 месяцев назад
yeah but this seem not so much different compare to ResponseEntity, does it have better performance ?
@georgebanin4812
@georgebanin4812 10 месяцев назад
what theme is that?
@ashishranjan9731
@ashishranjan9731 4 месяца назад
Can you please compare with feignclient
@maksimmuruev423
@maksimmuruev423 6 месяцев назад
You're missed huge and impotant thing here.. error handling.. not everytime you have data on the other end.. so you have two type of errors, expected ones like 'errorCode': 11, which is not in your regular POJO file.. and unxpected ones like .. gateway error in http response.. 500 errors with something weird in body and last errors without HTTP error like API return always 200 but sometimess like "error": "not found item" intead of item object. Can this annotation handle all the cases?
@orhn
@orhn 10 месяцев назад
Is “DeleteMapping” typo while others are Exchange?
@DanVega
@DanVega 10 месяцев назад
Yes, just a typo. Thanks for letting me know.
@attoumak
@attoumak 10 месяцев назад
In the interface why do you use @DeleteMapping instead of @DeleteExchange?
@DanVega
@DanVega 10 месяцев назад
Just a typo
@attoumak
@attoumak 10 месяцев назад
@@DanVega Since your tests passed, that means we can use MVC annotations in interface declaration?
@MrSurprise777
@MrSurprise777 6 месяцев назад
It's so short comparing to the RestTemplate or WebClient. Let's record the video about Open Feign declarative client.
@scerrisebastien
@scerrisebastien 9 месяцев назад
Clearly there is big misunderstanding with rest template. I worked with 2 compagnies that decide to replace all rest template/opeinfeign clients with webclient because of the misunderstanding
@scerrisebastien
@scerrisebastien 9 месяцев назад
By the way if I'm not wrong rest template is still used in spring security Servlet for oauth2 flow
@mertkaraman06
@mertkaraman06 10 месяцев назад
Sir i have a question I wanted to build a spring book project but i have an issue. I have an author and a book entity. They are related to each other. These 2 are in same microservice. How can i seperate them. I use this rest client but how i related them?
@cviniciusm
@cviniciusm 10 месяцев назад
Microservices doesn't mean a separate service for each entity, microservice is fine tuning services that make sense, thin close instead of wide open. Does make sense a author microservice alone? What is it purpose alone? Book can be managed by a microservice alone, and author be part of this microservice because a book must have one or more authors. I don't think you should separate them. Microservices provides high degree of maintainability, you could manage book and author independent of each other, but as they are close related, the cost to maintain the relationship could be greater than to maintain them separated. Each time you search a book and show it to the user, you must show the names of the authors too, you will not show id's of authors instead, right. If the author is a separated microservice than you will have to make extra call just to get author data each time you search for book or just before you present a book to the user.
@mertkaraman06
@mertkaraman06 10 месяцев назад
@@cviniciusm my author has crud operations only. author - book relation is many to one. I use this in entity. I got your idea btw. Thank you very much 🙏
@salo.
@salo. 9 месяцев назад
Cool... another video without headers examples...exactly as hundreds others on YT.. 18 min of pure water... Really useful
@DanVega
@DanVega 9 месяцев назад
.header() on uri() or you can add a defaultHeader( ) to the RestClient.builder()
@salo.
@salo. 9 месяцев назад
@@DanVega thanks for your answer. Will you do the video with custom requests?
@M_Jaggard
@M_Jaggard 10 месяцев назад
I don't get why anyone would be excited about ANOTHER new HTTP client! There are now hundreds - at least 3 in Spring alone. All because we don't want to use an existing dependency but add it to the more general Spring bloat‽
@cviniciusm
@cviniciusm 10 месяцев назад
I am not excited, I am curious. Just use one that fit your project or your company guidelines.
Далее
Самое Романтичное Видео ❤️
00:16
Дарю Самокат Скейтеру !
00:42
Просмотров 423 тыс.
Spring Boot Rest Client Interceptors
14:00
Просмотров 9 тыс.
Spring Boot APIs Gateway in 20 Minutes
22:50
Просмотров 8 тыс.
How To Call a REST API In Java - Simple Tutorial
29:14
Просмотров 260 тыс.
🚀 New in Spring Framework 6.1: RestClient
13:16
Просмотров 9 тыс.
Bootiful Spring Boot 3 by Josh Long @ Spring I/O 2023
49:44
Why use Type and not Interface in TypeScript
14:12
Просмотров 194 тыс.