liveBook · Manning

Chapter 11: Consuming REST endpoints

What you will learn in chapter 11 of Spring Start Here, Second Edition

This introduction explains why a Spring backend may need to call another service’s REST endpoints and why developers need to understand the available approaches.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains why a Spring backend may need to call another service’s REST endpoints and why developers need to understand the available approaches.

Key terms: REST services, REST endpoint, backend component, REST endpoints, available approaches

11.1 What do you need to know?

This section compares when to use three Spring REST clients and introduces the payment endpoint used to demonstrate them.

Key terms: RestClient, OpenFeign, WebClient, non-blocking calls, payment service, Payment, HTTP POST, request header, request body, response header

11.2 Calling REST endpoints using RestClient

This section shows how a Spring app uses RestClient to call another app’s REST endpoint and return its response.

Key terms: RestClient, proxy, controller, /payment endpoint, Spring WebMvc dependency, application.properties, Tomcat, port 9090, port 8080

11.3 Calling REST endpoints using Spring Cloud OpenFeign

The section shows how to consume a REST endpoint through an annotated OpenFeign interface and contrasts it with a legacy RestTemplate call.

Key terms: OpenFeign client, proxy interface, @FeignClient, name, url, @PostMapping, @EnableFeignClients, client contracts, bean, inject

11.4 Calling REST endpoints using WebClient

This section explains when WebClient fits a Spring app, how reactive tasks differ from a thread-bound flow, and how to use WebClient to call a REST endpoint.

Key terms: WebClient, reactive app, RestClient, OpenFeign, nonreactive app, thread, I/O call, tasks, producer, subscriber

11.5 Questions

This section lists questions for reviewing the chapter’s REST client concepts, with answers in Appendix A.

11.6 Summary

The section summarizes why backend apps call other apps’ REST endpoints and how to choose among Spring’s client options.

Concepts explained in this chapter

← Chapter 10: Implementing REST endpoints Chapter 12: Using data sources in Spring apps →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.