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

NoSuchBeanDefinitionException when configuring test that uses WebTestClient as described in the user guide #582

Closed
jnizet opened this issue Feb 18, 2019 · 3 comments
Assignees
Milestone

Comments

@jnizet
Copy link

jnizet commented Feb 18, 2019

The instructions in https://docs.spring.io/spring-restdocs/docs/2.0.3.RELEASE/reference/html5/#getting-started-documentation-snippets-setup cause an exception to be thrown. Replacing WebApplicationContext with ApplicationContext makes the test pass.

Here's a complete minimal project reproducing the issue: https://github.com/jnizet/webtestclientrestdocsissue

This test with WebApplicationContext fails, but this test with ApplicationContext passes.

@wilkinsona wilkinsona changed the title NoSuchBeanDefinitionException when configuring test as described in the user guide NoSuchBeanDefinitionException when configuring test that uses WebTestClient as described in the user guide Feb 18, 2019
@wilkinsona wilkinsona added this to the 2.0.4.RELEASE milestone Feb 18, 2019
@wilkinsona wilkinsona self-assigned this Feb 18, 2019
@wilkinsona
Copy link
Member

Thanks for the sample. WebApplicationContext is Servlet-specific so the docs are wrong for the WebTestClient case where the context is likely to be for a reactive web app.

@jnizet
Copy link
Author

jnizet commented Feb 18, 2019

Thanks for the explanation. That's what I suspected.

@wimdeblauwe
Copy link

Just ran into this as well. Will be good if this is fixed, would have avoided my SO question (https://stackoverflow.com/questions/55138027/spring-rest-docs-with-junit-5-and-webflux) :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants