liveBook · Manning

Endpoint

As explained in Spring Start Here, Second Edition

An endpoint is a network-accessible interface through which a service exposes or consumes an operation or resource.

A REST endpoint is a network-accessible operation a client can call over HTTP. In Spring, it is a controller action mapped to an HTTP method and path. section 10.1

Spring MVC handles the request, but the response differs from a page-rendering flow: the controller’s return value goes directly into the HTTP response body instead of being used to find a view. Mark a method with @ResponseBody, or use @RestController on the class to apply that behavior to its actions. section 10.1 section 10.2

A small endpoint

A HelloController action mapped with @GetMapping("/hello") can return "Hello!" as the response body. Call it with `curl http://localhost:8080/hello`; the example returns `Hello!`. section 10.2

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.

Follow how Spring MVC returns the controller’s data directly to the client without rendering a view. section 10.1

Endpoints connect web or mobile clients to a backend, and can also let backend services communicate. Consider practical limits: slow actions, large requests, or too many concurrent calls can disrupt communication or overload an application. section 10.1

How Spring Start Here, Second Edition covers it

How deep it goes
Explains controller mapping and response-body handling through Spring MVC, without detailing the dispatcher servlet’s internals.
Examples
Uses HelloController mappings and tests requests with Postman and cURL.
What it assumes
Builds on Spring web-controller and HTTP method-and-path mapping knowledge, while introducing REST-specific response annotations.
What you can do after
Build it from scratch by mapping a Spring controller action to an HTTP method and path, then returning data in the response body.
How it connects
Connects REST endpoints with Spring MVC, HTTP responses, request parameters, path variables, and exception handling.

Also explained in

Compare how 31 books explain endpoint →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.