@@ -331,6 +331,12 @@ you can use in your unit and integration tests in conjunction with the TestConte
331
331
framework. Refer to the corresponding javadocs for further information, including
332
332
default attribute values, attribute aliases, and so on.
333
333
334
+ ===== @BootstrapWith
335
+ `@BootstrapWith` is a class-level annotation that is used to configure how the _Spring
336
+ TestContext Framework_ is bootstrapped. Specifically, `@BootstrapWith` is used to specify
337
+ a custom `TestContextBootstrapper`. Consult the <<testcontext-bootstrapping,Bootstrapping
338
+ the TestContext framework>> section for further details.
339
+
334
340
===== @ContextConfiguration
335
341
`@ContextConfiguration` defines class-level metadata that is used to determine how to
336
342
load and configure an `ApplicationContext` for integration tests. Specifically,
@@ -980,6 +986,7 @@ annotations_ and reduce configuration duplication across a test suite.
980
986
Each of the following may be used as meta-annotations in conjunction with the
981
987
<<testcontext-framework,TestContext framework>>.
982
988
989
+ * `@BootstrapWith`
983
990
* `@ContextConfiguration`
984
991
* `@ContextHierarchy`
985
992
* `@ActiveProfiles`
@@ -1153,6 +1160,30 @@ locations__.
1153
1160
* `GenericPropertiesContextLoader`: loads a standard `ApplicationContext` from Java
1154
1161
Properties files.
1155
1162
1163
+ [[testcontext-bootstrapping]]
1164
+ ==== Bootstrapping the TestContext framework
1165
+
1166
+ The default configuration for the internals of the Spring TestContext Framework is
1167
+ sufficient for all common use cases. However, there are times when a development team or
1168
+ third party framework would like to change the default `ContextLoader`, implement a
1169
+ custom `TestContext` or `ContextCache`, augment the default sets of
1170
+ `ContextCustomizerFactory` and `TestExecutionListener` implementations, etc. For such low
1171
+ level control over how the TestContext framework operates, Spring provides a
1172
+ bootstrapping strategy.
1173
+
1174
+ `TestContextBootstrapper` defines the SPI for _bootstrapping_ the TestContext framework.
1175
+ A `TestContextBootstrapper` is used by the `TestContextManager` to load the
1176
+ `TestExecutionListener` implementations for the current test and to build the
1177
+ `TestContext` that it manages. A custom bootstrapping strategy can be configured for a
1178
+ test class (or test class hierarchy) via `@BootstrapWith`, either directly or as a
1179
+ meta-annotation. If a bootstrapper is not explicitly configured via `@BootstrapWith`,
1180
+ either the `DefaultTestContextBootstrapper` or the `WebTestContextBootstrapper` will be
1181
+ used, depending on the presence of `@WebAppConfiguration`.
1182
+
1183
+ Since the `TestContextBootstrapper` SPI is likely to change in the future in order to
1184
+ accommodate new requirements, implementers are strongly encouraged not to implement this
1185
+ interface directly but rather to extend `AbstractTestContextBootstrapper` or one of its
1186
+ concrete subclasses instead.
1156
1187
1157
1188
[[testcontext-tel-config]]
1158
1189
==== TestExecutionListener configuration
0 commit comments