diff --git a/spring-cloud-contract.html b/spring-cloud-contract.html index 488d4d2a6a..66ce0791bc 100644 --- a/spring-cloud-contract.html +++ b/spring-cloud-contract.html @@ -707,6 +707,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
If you add a stubs attribute to your @AutoConfigureWireMock then
-it will register WireMock JSON stubs from the file system or
-classpath. The stubs attribute can be a resource pattern (ant-style)
-or a directory, in which case */.json is appended. Example:
If you use @AutoConfigureWireMock then it will register WireMock
+JSON stubs from the file system or classpath, by default from
+file:src/test/resources/mappings. You can customize the locations
+using the stubs attribute in the annotation, which can be a resource
+pattern (ant-style) or a directory, in which case */.json is
+appended. Example:
|
+ Note
+ |
+
+Actually WireMock always loads mappings from
+src/test/resources/mappings as well as the custom locations in the
+stubs attribute. To change this behaviour you have to also specify a
+files root as described next.
+ |
+
WireMock can read response bodies from files on the classpath or file
+system. In that case you will see in the JSON DSL that the response
+has a "bodyFileName" instead of a (literal) "body". The files are
+resolved relative to a root directory src/test/resources/files by
+default. To customize this location you can set the files attribute
+in the @AutoConfigureWireMock annotation to the location of the
+parent directory (i.e. the place where files is a
+subdirectory). You can use Spring resource notation to refer to
+file:… or classpath:… locations (but generic URLs are not
+supported). A list of values can be given and WireMock will resolve
+the first file that exists when it needs to find a response body.
|
+ Note
+ |
+
+when you configure the files root, then it affects the
+automatic loading of stubs as well (they come from the root location
+in a subdirectory called "mappings"). The value of files has no
+effect on the stubs loaded explicitly from the stubs attribute.
+ |
+