REST Top
Get started with Spring 5 and Spring Boot 2, through the reference Learn Spring course:
>> CHECK OUT THE COURSEBuilding a REST API is not a trivial task – from the high level RESTful constraints down to the the nitty-gritty of making everything work and work well.
Spring has made REST a first class citizen and the platform has been maturing in leaps and bounds. With the Spring 5 release, REST is now battle hardened and fully mature.
With this guide, my aim is to organize the mountains of information that are available on the subject and guide you through properly building an API.
The guide starts with the basics – bootstrapping the REST API, the Spring MVC Configuration, basic customization.
It then dives into the more advanced areas of REST – HATEOAS and pagination, Error Handling and testing.

REST API Basics
- Bootstrapping a Web Application
- Building a REST API
- The Spring @Controller and @RestController Annotations
- Error Handling for REST (popular)
- Entity To DTO Conversion for a Spring REST API
- Spring’s RequestBody and ResponseBody Annotations
- How to Read HTTP Headers in Spring REST Controllers
- Using Spring @ResponseStatus to Set HTTP Status Code
- Using Spring ResponseEntity to Manipulate the HTTP Response

REST API Advanced Topics
- Setting Up Swagger 2 with a Spring REST API
- Documenting a Spring REST API Using OpenAPI 3.0
- Request Method Not Supported (405) in Spring
- Versioning a REST API
- REST Pagination
- ETags for REST
- Spring MVC Content Negotiation
- Spring REST API with Protocol Buffers
- A Custom Media Type for a Spring REST API
- Handling URL Encoded Form Data in Spring REST
- Generate Spring Boot REST Client with Swagger
- Spring REST API + OAuth2 + Angular (popular)
- Setting a Request Timeout for a Spring REST API

Test and Consume the API
- Test a REST API with Java
- The Guide to RestTemplate
- RestTemplate Post Request with JSON
- RestTemplate with Basic Authentication
- Get and Post Lists of Objects with RestTemplate
- Configure a RestTemplate with RestTemplateBuilder
- Spring RestTemplate Error Handling
- Uploading MultipartFile with Spring RestTemplate
- Spring WebClient vs. RestTemplate
- Spring WebClient Requests with Parameters
- Spring WebClient Filters
- Spring WebClient and OAuth2 Support
- Spring RestTemplate Request/Response Logging
- Reading an HTTP Response Body as a String in Java

Other Spring Tutorials
-
Persistence with Spring Tutorial
Building the Persistence Layer of an application with Spring and Hibernate, JPA, Spring Data, etc -
Spring Exceptions Tutorial
Common Exceptions in Spring with examples – why they occur and how to solve them quickly -
Security with Spring
How to Secure an MVC project, Login and Logout, how to Secure a REST Service, Basic and Digest Authentication with Spring Security
Spring bottom
Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:
>> THE COURSEREST bottom
Get started with Spring 5 and Spring Boot 2, through the Learn Spring course :
>> CHECK OUT THE COURSEREST footer banner


Learning to build your API
with Spring?
Download the E-book
with Spring?