接口 ContextCustomizerFactory

所有已知实现类:
DuplicateJsonObjectContextCustomizerFactory, DynamicPropertiesContextCustomizerFactory, ExcludeFilterContextCustomizerFactory, ImportsContextCustomizerFactory, MockitoContextCustomizerFactory, MockServerContainerContextCustomizerFactory, TestRestTemplateContextCustomizerFactory, WebTestClientContextCustomizerFactory
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface public interface ContextCustomizerFactory
Factory for creating ContextCustomizers.

Factories are invoked after ContextLoaders have processed context configuration attributes but before the MergedContextConfiguration is created.

By default, the TestContext Framework will use the TodayStrategies mechanism for loading factories configured in all META-INF/today.strategies files on the classpath.

it is also possible to register factories declaratively via the @ContextCustomizerFactories annotation.

从以下版本开始:
4.0
作者:
Phillip Webb, Sam Brannen, Harry Yang
另请参阅:
  • 方法详细资料

    • createContextCustomizer

      @Nullable ContextCustomizer createContextCustomizer(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes)
      Create a ContextCustomizer that should be used to customize a ConfigurableApplicationContext before it is refreshed.
      参数:
      testClass - the test class
      configAttributes - the list of context configuration attributes for the test class, ordered bottom-up (i.e., as if we were traversing up the class hierarchy); never null or empty
      返回:
      a ContextCustomizer or null if no customizer should be used