Description
In #9522 and #9166 , we're making sure that codecs auto-configuration and other customizations are properly applied to the WebClient
when using WebClient.Builder
components created by Boot.
This issue is about possibly aligning some/all of those in WebTestClient
.
Looking at Spring Framework's WebClient.Builder
and WebTestClient.Builder
, those interfaces don't share a common parent even if they have a few identical methods.
With the current arrangement, Spring Boot could apply all CodecCustomizer
instances to the WebTestClient
; in that case, both client and test client instances would share the same codec configuration.
Spring Boot could go further (and actually align its behavior there with what happens with RestTemplateBuilder
and TestResTemplate
) and apply all customizations done by WebClient.Builder
to the test client. The fact that WebClient.Builder
and WebTestClient.Builder
aren't related make it harder to achieve. Also, the WebTestClient
can be used for integration tests and mock environments, each having different configuration capabilities.
Applying CodecCustomizer
instances might be enough, and other features should not be applied to the test client. Indeed, a WebClient
is probably used to call remote services and the test client the application itself...