REST services let applications communicate through endpoints: a client makes an HTTP call, and a server returns data in the response. In Spring, an endpoint is a controller action mapped to an HTTP method and path. Unlike a page-rendering action, it returns data directly without resolving a view. section 10.1
A Spring REST endpoint can handle both sides of the exchange:
- Return the response body directly with @ResponseBody or use @RestController. Return ResponseEntity when you need to manage the HTTP status or headers. section 10.6
- Receive client data through request parameters, path variables, or the HTTP request body. section 10.6
- Handle exceptions in the endpoint action or separate that logic into REST controller advice; handling exceptions in individual actions can duplicate code. section 10.6
REST is used between web clients and servers, mobile apps and backends, and backend services. Keep practical limits in mind: slow requests, large payloads, or too many concurrent calls can cause timeouts or put pressure on an app. section 10.1
Figure 10.2 When implementing REST endpoints, the Spring MVC flow changes. The app no longer needs a view resolver because the client needs the data returned by the controller’s action directly. Once the controller’s action is completed, the dispatcher servlet returns the HTTP response without rendering any view.

The flow diagram shows how Spring MVC returns the controller action’s data without rendering a view. section 10.1





























