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

Use "non-blocking" thread for server-less tests in WebTestClient #23936

bsideup opened this issue Nov 5, 2019 · 0 comments

Use "non-blocking" thread for server-less tests in WebTestClient #23936

bsideup opened this issue Nov 5, 2019 · 0 comments


Copy link

@bsideup bsideup commented Nov 5, 2019


As was reported on Gitter, WebTestClient uses the same thread to execute the controller's methods.
In case of Webflux, it means that Reactor's built-in blocking call detection (e.g. calling mono.block()) or more advanced checks like BlockHound will not detect anything, since the thread is not non-blocking.

Since it creates a false positive feeling that the app does not have blocking calls, it would be better if WebTestClient with Webflux would mimic the non-blocking nature of the Webflux calls and move the subscription to e.g. Schedulers.parallel()


It is possible to customize the WebTestClient and manually move the subscription to the parallel scheduler:

public class WebTestClientConfig implements WebTestClientBuilderCustomizer {

    public void customize(WebTestClient.Builder builder) {
        builder.filter((clientRequest, next) ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.