You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are creating our WebClient's using the base API that overrides Spring Boot's defaults. This was not an intentional choice; it's just the first thing we tried.
There are three main approaches to WebClient customization, depending on how broadly you want the customizations to apply.
(1) To make the scope of any customizations as narrow as possible, inject the auto-configured WebClient.Builder and then call its methods as required. WebClient.Builder instances are stateful: Any change on the builder is reflected in all clients subsequently created with it. If you want to create several clients with the same builder, you can also consider cloning the builder with WebClient.Builder other = builder.clone();.
(2) To make an application-wide, additive customization to all WebClient.Builder instances, you can declare WebClientCustomizer beans and change the WebClient.Builder locally at the point of injection.
(3) Finally, you can fall back to the original API and use WebClient.create(). In that case, no auto-configuration or WebClientCustomizer is applied.
I realized that if you use spring boot you should not define the WebClient bean like this [option 3]. Spring boot normally configures a WebClient.Builder instance that considers settings like spring.jackson.serialization.write-dates-as-timestamps=false etc. and creates a WebClient bean for you, using this builder. But if you create a WebClient bean like this [option 3], the settings in spring boot’s builder are lost - and so are you! 😉
The text was updated successfully, but these errors were encountered:
We are creating our WebClient's using the base API that overrides Spring Boot's defaults. This was not an intentional choice; it's just the first thing we tried.
We are currently using option 3, like this:
moh-keycloak-user-management/backend/src/main/java/ca/bc/gov/hlth/mohums/webclient/WebClientConfig.java
Line 54 in cf502f4
We should be using option 2, like this:
Reason to make the change
Quoting this comment:
The text was updated successfully, but these errors were encountered: