Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Spring Boot RestClient.Builder Explained - Builder Pattern

Dan Vega via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn the crucial differences between RestClient.create() and injecting RestClient.Builder in Spring Boot applications, with deep insights into the Builder Pattern and Spring's auto-configuration features. Discover why choosing the right approach significantly impacts observability, metrics, and overall application architecture through practical examples using the JSON Placeholder API. Explore the Builder Pattern fundamentals in Java, examining how it solves common problems with mutable Java Beans and telescoping constructors while providing immutable, readable object creation. Understand Spring Boot's RestClientAutoConfiguration and how the auto-configured DefaultRestClientBuilder includes essential features like observability hooks, message converters, and customizers that are missing when using the static factory method. Master making HTTP calls with RestClient while learning when to leverage Spring's dependency injection versus manual control, complete with hands-on examples and best practices for modern Spring Boot development.

Syllabus

- Intro & the question from Spring Office Hours
- Why RestClient over RestTemplate
- Setting up the project on start.spring.io
- Using RestClient.create with a static factory method
- Making an HTTP GET call to JSON Placeholder
- The Builder Pattern in Java — why it exists
- Java Beans approach mutable, verbose
- Telescoping constructors approach
- Builder Pattern with immutable fields
- Applying the Builder Pattern to RestClient.Builder
- Spring auto-configures DefaultRestClientBuilder
- Why inject Builder instead of calling create
- Observability, metrics, and customizers
- When you might want manual control
- Wrap up & recommendations

Taught by

Dan Vega

Reviews

Start your review of Spring Boot RestClient.Builder Explained - Builder Pattern

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.