This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Framework 6.1.12! |
@ContextCustomizerFactories
@ContextCustomizerFactories
is used to register ContextCustomizerFactory
implementations for a particular test class, its subclasses, and its nested classes. If
you wish to register a factory globally, you should register it via the automatic
discovery mechanism described in
ContextCustomizerFactory
Configuration.
The following example shows how to register two ContextCustomizerFactory
implementations:
-
Java
-
Kotlin
@ContextConfiguration
@ContextCustomizerFactories({CustomContextCustomizerFactory.class, AnotherContextCustomizerFactory.class}) (1)
class CustomContextCustomizerFactoryTests {
// class body...
}
1 | Register two ContextCustomizerFactory implementations. |
@ContextConfiguration
@ContextCustomizerFactories([CustomContextCustomizerFactory::class, AnotherContextCustomizerFactory::class]) (1)
class CustomContextCustomizerFactoryTests {
// class body...
}
1 | Register two ContextCustomizerFactory implementations. |
By default, @ContextCustomizerFactories
provides support for inheriting factories from
superclasses or enclosing classes. See
@Nested
test class configuration and the
@ContextCustomizerFactories
javadoc for an example and further details.