ramkr
ramkr

Reputation: 41

Using WebClient with block() and RestTemplate is same?

from what I understand about Web Client is it's non blocking meaning the client does not need to wait till the response arrives and can do other tasks parallelly But then using block() in Web Client supports requests synchronously is there any slightest performance advantage when using Web client with block vs using Rest Template or both are same Basically if I have to use Web Client with block, then its better to still stick with Rest Template?

Upvotes: 1

Views: 933

Answers (1)

lkatiforis
lkatiforis

Reputation: 6255

RestTemplate is in maintenance mode and Spring advises us to use WebClient instead, see Javadocs.

However, using block(), WebClient offers the same synchronous way of working as RestTemplate does.

Upvotes: 1

Related Questions