Spring MVC Http Interfaces - How to Create a Rest Client with almost no code!

Spring MVC Http Interfaces - How to Create a Rest Client with almost no code!

Dan Vega

4 месяца назад

11,322 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@bibahbibah5108
@bibahbibah5108 - 03.06.2024 00:47

spring boot 3.2 has very nice futures.
it's a remplacement of feign dependencies, i hope that we can do wht feign do (headers and interceptor )

Ответить
@user-vr1od8gk5d
@user-vr1od8gk5d - 20.04.2024 18:53

how to modify request headers in this case (for example, with some bearer token )?

Ответить
@maksimmuruev423
@maksimmuruev423 - 27.03.2024 23:09

Buy what will happen if gateway is not available.. or its return some specific JSON error? We are in network it has no 100% response guarantee.

Ответить
@replicant777
@replicant777 - 17.03.2024 13:29

Hi Dan! Great video! Currently we are on spring boot 2 and use feign (incl some spring integrations like oauth2 or decoders) for creating rest clients to all apis where there are no public java client apis available. Works really great and we love the declarative style. What's the benefit of using this new spring way and will spring feign support be discontinued?

Ответить
@aravintht.k9276
@aravintht.k9276 - 16.03.2024 18:14

Hi Dan, Great video. Can we handle exceptions thrown from the other service using @ControllerAdvice like we normally do or it has any restrictions on that?

Ответить
@DineshRN751
@DineshRN751 - 13.03.2024 06:29

Using this approach with webclient for a while now, and it kind of gets messy creating beans for each rest. Spring Boot should have some annotation or something to solve this.. Or a custom annotation to do this?

Ответить
@andytael
@andytael - 12.03.2024 23:40

Maybe a strange question, but doesn't Feign do this already (with Eureka discovery) and it is easy? Or am I missing something. Awesome video!

Ответить
@brayanhernandezmora8619
@brayanhernandezmora8619 - 09.03.2024 10:53

Junior question it’s feing client good for doing this ?

Ответить
@scitechplusexplorer2484
@scitechplusexplorer2484 - 07.03.2024 06:21

Hi Dan! Nice video.
Can you please make some fresh content related to Spring GraphQL, although u have made it, but still once again, but not just basics, some pretty advanced stuff!!

Ответить
@amjedallaya9688
@amjedallaya9688 - 06.03.2024 15:25

Thnx Dan, great video as usual, but can you please try to use dark mode for the videos...
as a member of dracula developers community I really find it hard to follow the code with all these brightness 😅🤣

Ответить
@richardbenes9
@richardbenes9 - 04.03.2024 15:31

Nice tutorial, thanks. What about handling non-200 return codes though?

Ответить
@renatmirzoev2167
@renatmirzoev2167 - 03.03.2024 16:42

But what if I want to have some custom error handler for cases like Not Found? Or throw an exception?

Ответить
@AdrianVrabie
@AdrianVrabie - 03.03.2024 15:37

That's great for demos and MVPs. In RL you might need to put some specific headers in the calls, which can be path dependent :)

Ответить
@AgrimRocks
@AgrimRocks - 03.03.2024 01:38

If you are using ultimate edition, you can create new project using spring initializer from within the ide using File -> New Project -> Spring Initializer

Ответить
@hassanrefaat572
@hassanrefaat572 - 02.03.2024 21:28

how about if i want to handle the exception which is maybe happen form the upstream service how could i do that?

Ответить
@AleksandarT10
@AleksandarT10 - 02.03.2024 18:47

Hopefully the Spring team adds some kind of annotation on top of the interface so we dont have to do the boiler plate code in the future!

Ответить
@Razpirato
@Razpirato - 02.03.2024 16:12

It be great if you could add retries.

Ответить
@arghyamitra3281
@arghyamitra3281 - 02.03.2024 09:54

Great 💯 love to see how to add interceptor ( eg: want to add a header ) nd error handling with it

Ответить
@manojdahiya9332
@manojdahiya9332 - 02.03.2024 06:10

Hi Dan,
What do you think about using openfeign

Ответить
@JamesStansell
@JamesStansell - 02.03.2024 05:57

Thanks Dan! I am really curious to know if the fields of the Geo class populated correctly :)

Ответить
@RicardoSilvaTripcall
@RicardoSilvaTripcall - 02.03.2024 04:05

Another great tutorial Dan, congrats.
Silly question, how to maintain the json field order in the response? They are all over the place here :)

Ответить
@cviniciusm
@cviniciusm - 02.03.2024 01:54

There are several online helpers to convert JSON to POJO.

Ответить
@morkhoudia9
@morkhoudia9 - 02.03.2024 01:30

Hi Dan , it will be intéressed a tutorial to use web client calling the use api by iterating and populate to h2 and benching for reactive and a non reactive client...

Ответить
@oskar9136
@oskar9136 - 02.03.2024 00:24

Hi Dan!

Ответить