Spring HTTP Interface Clients: Consuming HTTP services in Spring Boot

preview_player
Показать описание
In this tutorial you will build out a full REST API using Spring MVC. Next you will learn how to call that service by creating an Http Interface client in a separate service.

The Spring Frameworks lets you define an HTTP service as a Java interface with HTTP exchange methods. You can then generate a proxy that implements this interface and performs the exchanges. This helps to simplify HTTP remote access and provides additional flexibility for to choose an API style such as synchronous or reactive.

00:00:00 Introduction
00:01:34 Creating new projects in IntelliJ
00:03:29 Setting up the Article Service
00:04:47 Setting up the Content Service
00:06:38 Defining the Article class
00:08:47 Creating the API for the Article service
00:13:42 Setting up the Article client
00:16:11 Testing the endpoints manually
00:18:05 Implementing the HTTP Interface client
00:21:34 Adding new methods to the client
00:23:12 Creating the Content Controller
00:25:17 Testing the client's methods
00:27:30 Review and Conclusion

🔗Resources & Links mentioned in this video:

👋🏻Connect with me:

Рекомендации по теме
Комментарии
Автор

Sorry everyone for the repository being private but I have made it public and should be accessible now.

DanVega
Автор

I'd probably have another interface like ArticleOperations and have the controller implement it and the ArticleClient extend it. Just to keep the contract locked in a bit more and less "discovery". Would/will be nice when Spring starts adding more compile time annotation processing. Can't beat Micronaut HTTP clients. Good video, as usual.

GreggBolinger
Автор

What about error handling? if the articles-service returns server error or anything unexpected?

kyriakosmandalas
Автор

How to attach OAuth token for HTTP Interface client request as bearer.

Anbu_Sampath
Автор

Please make video on spring cloud circuit breaker pattern concept and implementation by not using Hystrix. Thanks Dan.

praveens
Автор

Great content Dan aa ever!! Keep itnup.

Can you do a video on how to use the different annotations in Spring Boot 3 and the different packages such as controller, model and repository?

flyinghorse
Автор

good video. I hope that you will make video on error handling and resiliency in Http Client.

ashishsengar
Автор

Great stuff! How about Exception Handling, getting Headers etc? Need to create the Client at runtime. Questions over Questions :D Interesting content!

Nico-lylh
Автор

Great content! Thanks a lot and keep them coming Dan!

AleksandarT
Автор

Can you please do a tutorial on exception handling when using HTTP exchange

vistakb
Автор

1.) Do you have a tutorial on the blocking/non-blocking topic?
2.) How can I log the response body for debugging for failing requests?

derBobby
Автор

I have a unrelated question. What's your mic and holder? I want to update my setup and I like it, but didn't know the device.

mars
Автор

One thing that I don't like is to copy the Article type. Instead, we could have the client and dto types served as a library by the article service. Like a side car library that is produced by it's service.

blipintime
Автор

Great video! Btw why the github repository is non-existant?

anderfolgfu
Автор

Really nice!! Is there any benefits use this interfaces, instaed of using Feign?!

rafaband
Автор

What is the background (the picture with all the items showing on the leftside) comes from? My IntelliJ does not have this

lindayang
Автор

Thanks ! what is the benefit of this approach?? we could also create interface and inject it and then springboot will pick up its implementation at run time

lonesareer
Автор

I've always thought it is not good to use both Spring web and Spring reactive web. Is my assumption wrong?

felixnjunge
Автор

Can you tell us, ho you would structure the model? You need the exact same model in two different applications. How can you make sure it's the same in all you applications?

viktorreichert
Автор

Amazing content as always, Thanks for that. When I tried to access the git repo it shows a 404.
I have a couple of questions, Where reactive dependencies are used? I couldn't see. I still don't like the idea of using both web and reactive, it can be difficult to explain in an enterprise project, is there anything planned to include on spring web?
What if I use some authentication for endpoint, how should I do it?

andreibalzan