-
Notifications
You must be signed in to change notification settings - Fork 41.2k
@AutoConfigureRestDocs does not work with a MockMvc-backed WebTestClient #35348
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
Comments
@lukg I'm not sure I've fully understood what you're trying to do but we have an integration test for what I think you've described so I'm not sure why it apparently isn't working for you. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue. |
No problem, I will prepare some minimal project with this issue and dummy fix for it. |
Thanks, @lukg. There's no need for a fix just yet. I'd like to understand the problem first. |
@wilkinsona here is the repo link,
after dummy fix all 4 cases works. |
Thanks for the sample, @lukg. I now understand what you're trying to do. I had missed that fact that you were using |
Currently this is impossible to use autoconfigured WebTestClient with autoconfigured RestDocs together because of this error:
But there is possible to use WebTestClient together with MockMvc (for non full reactive app) - both can be injected in the same time.
The error is raised because of too restrictive autoconfiguration for RestDocs from
org.springframework.boot.test.autoconfigure.restdocs.RestDocsAutoConfiguration
.I pasted this configuration below:
What could be changed to improve this: replace
@ConditionalOnWebApplication(type = Type.REACTIVE)
with something smarter what could detect if the WebTestClient is also in use and than apply automaticallyRestDocsWebTestClientConfiguration
.The text was updated successfully, but these errors were encountered: