Spring Boot Rest Client - How to change the underlying HTTP Client

Sdílet
Vložit
  • čas přidán 5. 08. 2024
  • In this tutorial you will learn how to change the Http Client in the new Rest Client. The Rest Client has a fluent and easy to use API that makes communicating with services over HTTP intuitive.
    🔗Resources & Links mentioned in this video:
    GitHub Repo: github.com/danvega/rest-clien...
    Rest Client Docs: docs.spring.io/spring-framewo...
    👋🏻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 ❤️
  • Věda a technologie

Komentáře • 34

  • @comicalInsan
    @comicalInsan Před 6 měsíci +14

    please create chapters in your videos. It helps a lot.

  • @abdulfatorma348
    @abdulfatorma348 Před 6 měsíci

    Thank you for your tutorial, you are such a great person may God continue to bless you. Please sir make a tutorial on Java Back End with all the topics that will makes someone to become Java back end developer.
    Thank you

  • @assaduzzaman_dsi
    @assaduzzaman_dsi Před 6 měsíci +7

    Nice. Hope to see jwt token propagation.

    • @jalsa09life
      @jalsa09life Před 6 měsíci

      Second that! Would love to see a sample of a front end webapp with JWT for user auth instead of spring session

  • @sarkar_957
    @sarkar_957 Před 6 měsíci +1

    Hey dan how do you move on with new feature added in each new version of spring boot.
    I mean after looking at new release changes you go and understand them/learn them ?

  • @Techlovers-daveInTheCloud
    @Techlovers-daveInTheCloud Před 5 měsíci

    By any chance, do you have an example of spring-boot project native image using web client (looking for the hint registration) ?

  • @Nico-ly7lh
    @Nico-ly7lh Před 16 dny

    which color theme are you using? Haveing issues reading white on dark, but your template feels like wellness to my eyes

  • @SandipChitale
    @SandipChitale Před 6 měsíci +1

    Nice video
    Could you do videos on the following topics:
    - How to implement per-request connection and read timeout?
    - How to implement complete request and response streaming (success and failure 4xx and 5xx HTTP STatus) with ability to manipulate request and response headers? The body of request and response is to be completely streamed.

    • @DanVega
      @DanVega  Před 6 měsíci

      As far as I know there is no way to do that on a per request basis. Why would you want to do that?

    • @foo3234
      @foo3234 Před 6 měsíci +1

      @@DanVega Dan.... 99% of comments are from bot accounts, its not a real request.

    • @sarkar_957
      @sarkar_957 Před 6 měsíci +1

      @@foo3234 broo 😂😂 really?

    • @Muescha
      @Muescha Před 6 měsíci

      ​ @foo3234 especial that ones with user names with some chars at the start and many numbers on the end are 99% bot accounts

  • @siddharthshankarpaul
    @siddharthshankarpaul Před 6 měsíci +1

    Hope OkHttp 5 gets added.

  • @francescospampinato3458
    @francescospampinato3458 Před 6 měsíci +2

    What can be used to mock responses for RestClient in my integration tests?

    • @DanVega
      @DanVega  Před 6 měsíci +3

      You can use RestClientTest. I have an example here and I'm working on a video for that
      github.com/danvega/rest-client-examples/blob/main/src/test/java/dev/danvega/rc/client/PostServiceTest.java

    • @gallardofabian
      @gallardofabian Před 6 měsíci

      Thanks for share. Maybe add an example with token, passport how inject With interceptors, etc.

  • @MagnusLundvall
    @MagnusLundvall Před 6 měsíci

    How can we create an insecure RestClient that don't verify SSL/TLS?

  • @danilagrishin4201
    @danilagrishin4201 Před 6 měsíci +1

    In which cases should we use RestTemplate or WebClient or Feign? Thanks!

    • @DanVega
      @DanVega  Před 6 měsíci +1

      If you are in a Spring MVC app use RestClient if you're in a Webflux app use WebClient.

    • @Anbu_Sampath
      @Anbu_Sampath Před 6 měsíci +1

      how about Spring HTTP Interface Clients?

  • @luisr8663
    @luisr8663 Před 6 měsíci

    Which has better performane: Rest Client or Feign Client?

  • @Muescha
    @Muescha Před 6 měsíci +1

    can you show the LiveTemplate for the RestClient? (or a link to a gist)

    • @Muescha
      @Muescha Před 6 měsíci

      Found the answer in the README in your repo rest-client-examples

  • @asfakmhmd
    @asfakmhmd Před 4 měsíci

    How to add ssl or client side certificates

  • @chrispure7461
    @chrispure7461 Před 6 měsíci +3

    How about Oauth2 support?

    • @DanVega
      @DanVega  Před 6 měsíci +1

      There is nothing built-in but its something we are looking into. Right now you could send a token via a header

    • @chrispure7461
      @chrispure7461 Před 6 měsíci +2

      @@DanVega ok. Don't we have to fetch token for ever call then? wish we had refresh token capability butiltin.

  • @aliksargsyan2782
    @aliksargsyan2782 Před 6 měsíci +3

    Is RestClient succesor of WebClient ?

    • @DanVega
      @DanVega  Před 6 měsíci +1

      No. In a Spring MVC blocking application you would usually reach for the RestTemplate unless you brought in Spring Webflux just for the WebClient. The Rest Client gives you a fluent imperative API similar to the Web Client.

    • @aliksargsyan2782
      @aliksargsyan2782 Před 6 měsíci +1

      @@DanVega aah ok 👌 thank you dear Dan.