Skip to content

Commit 635e331

Browse files
committed
Mention using AutoConfigureRestTestClient in a WebMvcTest
Closes gh-47948
1 parent 5f52a77 commit 635e331

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/testing/spring-boot-applications.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ Often, javadoc:org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest[for
347347
javadoc:org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest[format=annotation] also auto-configures javadoc:org.springframework.test.web.servlet.MockMvc[].
348348
Mock MVC offers a powerful way to quickly test MVC controllers without needing to start a full HTTP server.
349349
If AssertJ is available, the AssertJ support provided by javadoc:org.springframework.test.web.servlet.assertj.MockMvcTester[] is auto-configured as well.
350+
If you'd like to use javadoc:org.springframework.test.web.servlet.client.RestTestClient[] in your tests, annotate your test class with javadoc:org.springframework.boot.resttestclient.autoconfigure.AutoConfigureRestTestClient[format=annotation].
351+
A `RestTestClient` that uses the Mock MVC infrastructure will then be auto-configured.
350352

351353
TIP: You can also auto-configure javadoc:org.springframework.test.web.servlet.MockMvc[] and javadoc:org.springframework.test.web.servlet.assertj.MockMvcTester[] in a non-`@WebMvcTest` (such as javadoc:org.springframework.boot.test.context.SpringBootTest[format=annotation]) by annotating it with javadoc:org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc[format=annotation].
352354
The following example uses javadoc:org.springframework.test.web.servlet.assertj.MockMvcTester[]:

0 commit comments

Comments
 (0)