Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve WebTestClient auto-configuration with WebClient's customizations #9577

Closed
bclozel opened this issue Jun 22, 2017 · 1 comment
Closed
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Jun 22, 2017

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...

@bclozel bclozel added priority: high type: enhancement A general enhancement labels Jun 22, 2017
@bclozel bclozel added this to the 2.0.0.M3 milestone Jun 22, 2017
@bclozel bclozel self-assigned this Jun 22, 2017
@bclozel
Copy link
Member Author

bclozel commented Jun 22, 2017

Note: #9522 is about to be rewritten, and we should track SPR-15674 as it might be of interest.

bclozel added a commit to bclozel/spring-boot that referenced this issue Jun 23, 2017
This commit applies what's been done in spring-projectsgh-9166 for WebFlux client and
server, but for the `WebTestClient` auto-configuration.

`WebTestClient` can be configured for mock or integration tests and this
change applies `CodecCustomizer` beans to the client being built.

Closes spring-projectsgh-9577
@bclozel bclozel closed this as completed in f2e77e4 Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant