RestDocumentationRequestBuilders class is only use mockmvc. isn't it? However, when using the webtestclient, you must also use the RestDocumentationRequestBuilders.
Missing URL template - please use RestDocumentationRequestBuilders with urlTemplate to construct the request
com.epages.restdocs.apispec.ResourceSnippet$MissingUrlTemplateException: Missing URL template - please use RestDocumentationRequestBuilders with urlTemplate to construct the request
at com.epages.restdocs.apispec.ResourceSnippet$getUriComponents$2.get(ResourceSnippet.kt:104)
at com.epages.restdocs.apispec.ResourceSnippet$getUriComponents$2.get(ResourceSnippet.kt:21)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at com.epages.restdocs.apispec.ResourceSnippet.getUriComponents(ResourceSnippet.kt:104)
at com.epages.restdocs.apispec.ResourceSnippet.createModel(ResourceSnippet.kt:56)
at com.epages.restdocs.apispec.ResourceSnippet.document(ResourceSnippet.kt:34)
at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:191)
at org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation.lambda$document$0(WebTestClientRestDocumentation.java:77)
at org.springframework.test.web.reactive.server.DefaultWebTestClient$DefaultBodySpec.lambda$consumeWith$4(DefaultWebTestClient.java:582)
at org.springframework.test.web.reactive.server.ExchangeResult.assertWithDiagnostics(ExchangeResult.java:231)
at org.springframework.test.web.reactive.server.DefaultWebTestClient$DefaultBodySpec.consumeWith(DefaultWebTestClient.java:582)
RestDocumentationRequestBuilders
class is only use mockmvc. isn't it? However, when using the webtestclient, you must also use theRestDocumentationRequestBuilders
.build.gradle.kts
dependencieswebtestclient usage
Error message
Is there any way to solve this problem?