This is a collection of examples using the new RestClient in Spring Framework 6.1 & Spring Boot 3.2.
These are the topics that I would like to cover in this series:
RestClientInstance (org.springframework.web.client) ✅- static factory methods
- DefaultRestClientBuilder
- CRUD
- List
- Read
- Persist
- Query Params
- Testing with
@RestClientTest✅ - HTTP Interfaces
- Switching Http Client Libraries ✅
- Multipart Data
- Jackson JSON Views
- Error Handling
- Interceptors
- Retry (Interceptor)
- Proxy (SimpleClientHttpRequestFactory)
- Spring Cloud MVC
- Resilience
- Live Template ✅
The RestClient uses an underlying Http Client to make calls over HTTP. If you want to read more about this you can check
out the Spring Documentation. The
following video is a walkthrough of how to do that. The code for this is located in /src/main/resources/dev/danvega/rc/client/JdkClient.java
You can test your RestClient code using the @RestClientTest annotation.
Note
If you run into an issue writing tests with @RestClientTest and you're using the JDK Http Client you might be running
into this spring-projects/spring-boot#38832