O'Reilly logo

Mastering Spring Cloud by Piotr Minkowski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calling other services

Finally, we may begin to implement the OrderController responsible for serving HTTP methods exposed outside a microservice. It has the RestTemplate bean injected to be able to call other HTTP endpoints. You may see in the following source code fragment that uses the Ribbon client name configured in application.yml instead of IP address or hostname. Using the same RestTemplate bean, we can communicate with three different microservices. Let's just take a second here to discuss the methods available inside the controller. In the first of the implemented methods, we call the GET endpoint from product-service, which returns a list with details of selected products. Then, we invoke the GET /withAccounts/{id} method exposed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required