ContextInitializer class final
Marks a static method that changes the test class's context before it is refreshed, that is before any bean is created.
The method takes a ConfigurableApplicationContext. Use it for setup
that the other annotations cannot express, such as adding a bean
factory post-processor or a property source. Most tests need
TestBean or TestPropertySource instead. The method must be static.
// Makes the slow reports bean lazy, so the tests start faster.
@ContextInitializer()
static void lazyReports(ConfigurableApplicationContext context) =>
context.addBeanFactoryPostProcessor(LazyReports());
Spring (Java): an ApplicationContextInitializer named in
@ContextConfiguration(initializers = ...).
Constructors
- ContextInitializer()
-
Marks the method.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited