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

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 พ.ย. 2024

ความคิดเห็น • 67

  • @AleksandarT10
    @AleksandarT10 ปีที่แล้ว +15

    We need a new JdbcClient video as well!. Anyway the ParametrizedTypeReference stuff is lame a bit to write it still.

    • @DanVega
      @DanVega  ปีที่แล้ว +11

      Recording today!

    • @janetkalu3064
      @janetkalu3064 ปีที่แล้ว +1

      Thank you so much, you are a gem

    • @arghyamitra3281
      @arghyamitra3281 ปีที่แล้ว

      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 ปีที่แล้ว +1

      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.

  • @hayrullahyasar
    @hayrullahyasar ปีที่แล้ว +3

    Thank you for sharing. I like the new Rest Client.

  • @avdain
    @avdain ปีที่แล้ว +4

    Super excited for this feature! 🙌🏼

    • @DanVega
      @DanVega  ปีที่แล้ว +1

      Me too!

  • @Nico-ly7lh
    @Nico-ly7lh 3 หลายเดือนก่อน

    Thank you! We are re-building some clients, will directly remove the resttemplate with this new restclient to be safe for upcoming Spring updates

  • @Anbu_Sampath
    @Anbu_Sampath ปีที่แล้ว +1

    RestClient with Declarative Interface client is nice combo.

  • @the00one45
    @the00one45 ปีที่แล้ว +3

    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.

  • @nickphilippe9743
    @nickphilippe9743 ปีที่แล้ว +5

    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 11 หลายเดือนก่อน +2

      I was actually wondering the same. Would be really cool to see a video diving into comparison of those

  • @awjamesfrj
    @awjamesfrj ปีที่แล้ว +1

    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?

  • @VerhoevenSimon
    @VerhoevenSimon ปีที่แล้ว +2

    I really like the enhancements, now to hopefully get a more elegant solution for ParametrizedTypeReference in a future release.

    • @IvanRandomDude
      @IvanRandomDude ปีที่แล้ว +1

      It's just a limitation of Java.

  • @wagdynavas6337
    @wagdynavas6337 ปีที่แล้ว +1

    Do you recommend RestClient to make micro services calls?

  • @dandantin
    @dandantin 3 หลายเดือนก่อน

    Where did you get this spring t-shirt? It's awesome.

  • @nathanlively
    @nathanlively ปีที่แล้ว

    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();

  • @CarlosMartinsPT
    @CarlosMartinsPT หลายเดือนก่อน

    I see two elephants in the room there :)
    1 - what about error handling (what are the OK responses in terms of http-status) ?
    2 - what about client-load balancing en case there are multiple base URLs ?
    Can you elaborate on this? I would be super interested.

  • @TheMyth2.9
    @TheMyth2.9 9 หลายเดือนก่อน

    Hey this is great, so if I wanted to do an Integrated test with @SpringBootTest, I could just use this client directly right ?

  • @hkkabir2024
    @hkkabir2024 ปีที่แล้ว

    never used restclient, used resttemplate before so i will try this now.

  • @EltonBragaSilva
    @EltonBragaSilva 11 หลายเดือนก่อน

    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?

  • @andytael
    @andytael ปีที่แล้ว

    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 :-)

  • @WillianLuz-q1e
    @WillianLuz-q1e ปีที่แล้ว

    And Spring Feign client. Is it a good choice too? What is your opinion about? Thank you for the greate video o/

  • @МатвейСоболев-в5щ
    @МатвейСоболев-в5щ 10 หลายเดือนก่อน

    Cool, thanks! What about (1) proxies (2) SSL (self-signed, enterprise CA, ...) (3) error handling ?

  • @rioberliandinatamunas2454
    @rioberliandinatamunas2454 ปีที่แล้ว

    Hi Dan, Thats awesome 👍
    Would you like to make a vidoe about how to setup and solve comon issue with hikari?

  • @vernon_4411
    @vernon_4411 10 หลายเดือนก่อน

    I might miss something. Is the RestClient built on top of OkHttp? The code syntax is almost the same as OkHttp.

  • @traxex1975
    @traxex1975 ปีที่แล้ว

    With HTTP Interface in place, since you replaced PostService with it, you could remove PostService at the end 😊

  • @AmandeepSingh-hd8iq
    @AmandeepSingh-hd8iq ปีที่แล้ว

    Awesome video Dan. Love watching your live demos. As a side question: what theme is it? It's so elegant.

  • @SarkhanTakhirov
    @SarkhanTakhirov ปีที่แล้ว

    bro, thanks for video. but what about errorHandler, restTemplate had amazing option as ResponseErrorHandler, may be restClient has similar option too?

  • @harshsingh8175
    @harshsingh8175 ปีที่แล้ว

    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

  • @hamednikbakht9708
    @hamednikbakht9708 ปีที่แล้ว +2

    how to send token for this

  • @svalyavasvalyava9867
    @svalyavasvalyava9867 ปีที่แล้ว

    Awesome video, thank you ☺️

  • @sumitghatule713
    @sumitghatule713 ปีที่แล้ว

    Thank you for sharing.

  • @s3cario475
    @s3cario475 9 หลายเดือนก่อน

    Hey, what's a plugin which help to copletly words?

  • @salo.
    @salo. ปีที่แล้ว

    Cool... another video without headers examples...exactly as hundreds others on YT.. 18 min of pure water... Really useful

    • @DanVega
      @DanVega  ปีที่แล้ว +1

      .header() on uri() or you can add a defaultHeader( ) to the RestClient.builder()

    • @salo.
      @salo. ปีที่แล้ว

      @@DanVega thanks for your answer. Will you do the video with custom requests?

  • @orhn
    @orhn ปีที่แล้ว +2

    Is “DeleteMapping” typo while others are Exchange?

    • @DanVega
      @DanVega  ปีที่แล้ว +1

      Yes, just a typo. Thanks for letting me know.

  • @loic.bertrand
    @loic.bertrand 5 หลายเดือนก่อน

    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)

  • @azenkwed
    @azenkwed 10 หลายเดือนก่อน

    I am getting a 405 Method not allowed for the methods POST, PUT and DELETE. Only the GET Methods work. Any idea?

  • @attoumak
    @attoumak ปีที่แล้ว +2

    In the interface why do you use @DeleteMapping instead of @DeleteExchange?

    • @DanVega
      @DanVega  ปีที่แล้ว

      Just a typo

    • @attoumak
      @attoumak ปีที่แล้ว

      @@DanVega Since your tests passed, that means we can use MVC annotations in interface declaration?

  • @aaaaaaa2913
    @aaaaaaa2913 ปีที่แล้ว

    yeah but this seem not so much different compare to ResponseEntity, does it have better performance ?

  • @levis7085
    @levis7085 ปีที่แล้ว

    Does this provide any support to call APIs with Mtls?

  • @rickhunter8216
    @rickhunter8216 ปีที่แล้ว +1

    NICE T-SHIRT

  • @ashishranjan9731
    @ashishranjan9731 8 หลายเดือนก่อน

    Can you please compare with feignclient

  • @deepastephenson
    @deepastephenson ปีที่แล้ว

    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

  • @FalcoCorragioso
    @FalcoCorragioso 11 หลายเดือนก่อน

    It's so short comparing to the RestTemplate or WebClient.
    Let's record the video about Open Feign declarative client.

  • @rahuldebnath3919
    @rahuldebnath3919 10 หลายเดือนก่อน

    How to configure RestClient with OAuth2 to call protected endpoints

  • @traxex1975
    @traxex1975 ปีที่แล้ว

    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)

  • @georgebanin4812
    @georgebanin4812 ปีที่แล้ว

    what theme is that?

  • @scerrisebastien
    @scerrisebastien ปีที่แล้ว

    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 ปีที่แล้ว

      By the way if I'm not wrong rest template is still used in spring security Servlet for oauth2 flow

  • @Radhad85
    @Radhad85 11 หลายเดือนก่อน

    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?

  • @maksimmuruev423
    @maksimmuruev423 11 หลายเดือนก่อน

    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?

  • @shantohossain1372
    @shantohossain1372 ปีที่แล้ว

    i love this one

  • @mertkaraman06
    @mertkaraman06 ปีที่แล้ว

    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 ปีที่แล้ว +1

      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 ปีที่แล้ว

      @@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 🙏

  • @M_Jaggard
    @M_Jaggard ปีที่แล้ว +1

    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 ปีที่แล้ว

      I am not excited, I am curious. Just use one that fit your project or your company guidelines.