类 MergedContextConfiguration
- 所有已实现的接口:
Serializable
- 直接已知子类:
AotMergedContextConfiguration,ReactiveWebMergedContextConfiguration,WebMergedContextConfiguration
MergedContextConfiguration encapsulates the merged
context configuration declared on a test class and all of its superclasses
via @ContextConfiguration,
@ActiveProfiles, and
@TestPropertySource.
Merged context resource locations, annotated classes, active profiles,
property resource locations, and in-lined properties represent all declared
values in the test class hierarchy taking into consideration the semantics
of the ContextConfiguration.inheritLocations(),
ActiveProfiles.inheritProfiles(),
TestPropertySource.inheritLocations(), and
TestPropertySource.inheritProperties() flags.
A SmartContextLoader uses MergedContextConfiguration
to load an ApplicationContext.
MergedContextConfiguration is also used by the
ContextCache
as the key for caching an
ApplicationContext
that was loaded using properties of this MergedContextConfiguration.
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen, Phillip Webb, Harry Yang
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private final String[]private final CacheAwareContextLoaderDelegateprivate final Class<?>[]private final Set<ContextCustomizer>private final ContextLoaderprivate static final Class<?>[]private static final Set<ContextCustomizer>private static final String[]private final String[]private final MergedContextConfigurationprivate final List<cn.taketoday.core.io.PropertySourceDescriptor>private final String[]private final String[]private static final longprivate final Class<?> -
构造器概要
构造器构造器说明MergedContextConfiguration(MergedContextConfiguration mergedConfig) Create a newMergedContextConfigurationinstance by copying all fields from the suppliedMergedContextConfiguration.MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, String[] activeProfiles, ContextLoader contextLoader) Create a newMergedContextConfigurationinstance for the supplied parameters.MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, String[] activeProfiles, ContextLoader contextLoader) Create a newMergedContextConfigurationinstance for the supplied parameters.MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, String[] activeProfiles, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, Set<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, String[] activeProfiles, List<cn.taketoday.core.io.PropertySourceDescriptor> propertySourceDescriptors, String[] propertySourceProperties, Set<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters. -
方法概要
修饰符和类型方法说明booleanDetermine if the supplied object is equal to thisMergedContextConfigurationinstance by comparing both objects' locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, parents, and the fully qualified names of theirContextLoaders.String[]Get the merged active bean definition profiles for the test class.Class<?>[]Get the merged annotated classes for the test class.Get the mergedContextCustomizersthat will be applied when the application context is loaded.Get the mergedApplicationContextInitializerclasses for the test class.Get the resolvedContextLoaderfor the test class.String[]Get the merged resource locations forApplicationContextconfiguration files for the test class.Get theMergedContextConfigurationfor the parent application context in a context hierarchy.cn.taketoday.context.ApplicationContextGet the parentApplicationContextfor the context defined by thisMergedContextConfigurationfrom the context cache.List<cn.taketoday.core.io.PropertySourceDescriptor>Get the merged descriptors for resource locations for testPropertySourcesfor the test class.String[]Get the merged resource locations of properties files for the test class.String[]Get the merged inlined properties for the test class.Class<?>Get the test class associated with thisMergedContextConfiguration.booleanDetermine if thisMergedContextConfigurationinstance has class-based resources.inthashCode()Generate a unique hash code for all properties of thisMergedContextConfigurationexcluding the test class.booleanDetermine if thisMergedContextConfigurationinstance has path-based context resource locations.booleanDetermine if thisMergedContextConfigurationinstance has either path-based context resource locations or class-based resources.protected static StringnullSafeClassName(ContextLoader contextLoader) Generate a null-safeStringrepresentation of the suppliedContextLoaderbased solely on the fully qualified name of the loader or "null" if the supplied loader isnull.private static String[]processActiveProfiles(String[] activeProfiles) private static Class<?>[]processClasses(Class<?>[] classes) private static Set<ContextCustomizer>processContextCustomizers(Set<ContextCustomizer> contextCustomizers) processContextInitializerClasses(Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses) protected static String[]processStrings(String[] array) toString()Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, the name of theContextLoader, and the parent configuration.
-
字段详细资料
-
serialVersionUID
private static final long serialVersionUID- 另请参阅:
-
EMPTY_STRING_ARRAY
-
EMPTY_CLASS_ARRAY
-
EMPTY_INITIALIZER_CLASSES
-
EMPTY_CONTEXT_CUSTOMIZERS
-
testClass
-
locations
-
classes
-
contextInitializerClasses
-
activeProfiles
-
propertySourceDescriptors
-
propertySourceLocations
-
propertySourceProperties
-
contextCustomizers
-
contextLoader
-
cacheAwareContextLoaderDelegate
-
parent
-
-
构造器详细资料
-
MergedContextConfiguration
public MergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable String[] activeProfiles, ContextLoader contextLoader) Create a newMergedContextConfigurationinstance for the supplied parameters.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged context resource locationsclasses- the merged annotated classesactiveProfiles- the merged active bean definition profilescontextLoader- the resolvedContextLoader
-
MergedContextConfiguration
public MergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, @Nullable String[] activeProfiles, ContextLoader contextLoader) Create a newMergedContextConfigurationinstance for the supplied parameters.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged context resource locationsclasses- the merged annotated classescontextInitializerClasses- the merged context initializer classesactiveProfiles- the merged active bean definition profilescontextLoader- the resolvedContextLoader
-
MergedContextConfiguration
public MergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, @Nullable String[] activeProfiles, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged context resource locationsclasses- the merged annotated classescontextInitializerClasses- the merged context initializer classesactiveProfiles- the merged active bean definition profilescontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parentApplicationContextparent- the parent configuration ornullif there is no parent
-
MergedContextConfiguration
Create a newMergedContextConfigurationinstance by copying all fields from the suppliedMergedContextConfiguration. -
MergedContextConfiguration
public MergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, @Nullable String[] activeProfiles, @Nullable String[] propertySourceLocations, @Nullable String[] propertySourceProperties, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.If a
nullvalue is supplied forlocations,classes,activeProfiles,propertySourceLocations, orpropertySourcePropertiesan empty array will be stored instead. If anullvalue is supplied for thecontextInitializerClassesan empty set will be stored instead. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged context resource locationsclasses- the merged annotated classescontextInitializerClasses- the merged context initializer classesactiveProfiles- the merged active bean definition profilespropertySourceLocations- the mergedPropertySourcelocationspropertySourceProperties- the mergedPropertySourcepropertiescontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parentApplicationContextparent- the parent configuration ornullif there is no parent
-
MergedContextConfiguration
public MergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, @Nullable String[] activeProfiles, @Nullable String[] propertySourceLocations, @Nullable String[] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.If a
nullvalue is supplied forlocations,classes,activeProfiles,propertySourceLocations, orpropertySourcePropertiesan empty array will be stored instead. If anullvalue is supplied forcontextInitializerClassesorcontextCustomizers, an empty set will be stored instead. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged context resource locationsclasses- the merged annotated classescontextInitializerClasses- the merged context initializer classesactiveProfiles- the merged active bean definition profilespropertySourceLocations- the mergedPropertySourcelocationspropertySourceProperties- the mergedPropertySourcepropertiescontextCustomizers- the context customizerscontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parentApplicationContextparent- the parent configuration ornullif there is no parent
-
MergedContextConfiguration
public MergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> contextInitializerClasses, @Nullable String[] activeProfiles, List<cn.taketoday.core.io.PropertySourceDescriptor> propertySourceDescriptors, @Nullable String[] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, @Nullable ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) Create a newMergedContextConfigurationinstance for the supplied parameters.If a
nullvalue is supplied forlocations,classes,activeProfiles, orpropertySourcePropertiesan empty array will be stored instead. If anullvalue is supplied forcontextInitializerClassesorcontextCustomizers, an empty set will be stored instead. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged context resource locationsclasses- the merged annotated classescontextInitializerClasses- the merged context initializer classesactiveProfiles- the merged active bean definition profilespropertySourceDescriptors- the merged property source descriptorspropertySourceProperties- the merged inlined propertiescontextCustomizers- the context customizerscontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parentApplicationContextparent- the parent configuration ornullif there is no parent
-
-
方法详细资料
-
getTestClass
Get the test class associated with thisMergedContextConfiguration. -
getLocations
Get the merged resource locations forApplicationContextconfiguration files for the test class.Context resource locations typically represent XML configuration files or Groovy scripts.
-
getClasses
Get the merged annotated classes for the test class. -
hasLocations
public boolean hasLocations()Determine if thisMergedContextConfigurationinstance has path-based context resource locations.- 返回:
trueif thelocationsarray is not empty- 另请参阅:
-
hasClasses
public boolean hasClasses()Determine if thisMergedContextConfigurationinstance has class-based resources.- 返回:
trueif theclassesarray is not empty- 另请参阅:
-
hasResources
public boolean hasResources()Determine if thisMergedContextConfigurationinstance has either path-based context resource locations or class-based resources. -
getContextInitializerClasses
public Set<Class<? extends cn.taketoday.context.ApplicationContextInitializer>> getContextInitializerClasses()Get the mergedApplicationContextInitializerclasses for the test class. -
getActiveProfiles
Get the merged active bean definition profiles for the test class.- 另请参阅:
-
getPropertySourceDescriptors
Get the merged descriptors for resource locations for testPropertySourcesfor the test class.Properties will be loaded into the
Environment's set ofPropertySources. -
getPropertySourceLocations
Get the merged resource locations of properties files for the test class. -
getPropertySourceProperties
Get the merged inlined properties for the test class.Properties will be loaded into the
Environment's set ofPropertySources. -
getContextCustomizers
Get the mergedContextCustomizersthat will be applied when the application context is loaded. -
getContextLoader
Get the resolvedContextLoaderfor the test class. -
getParent
Get theMergedContextConfigurationfor the parent application context in a context hierarchy.- 返回:
- the parent configuration or
nullif there is no parent - 另请参阅:
-
getParentApplicationContext
@Nullable public cn.taketoday.context.ApplicationContext getParentApplicationContext()Get the parentApplicationContextfor the context defined by thisMergedContextConfigurationfrom the context cache.If the parent context has not yet been loaded, it will be loaded, stored in the cache, and then returned.
- 返回:
- the parent
ApplicationContextornullif there is no parent - 另请参阅:
-
equals
Determine if the supplied object is equal to thisMergedContextConfigurationinstance by comparing both objects' locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, parents, and the fully qualified names of theirContextLoaders. -
hashCode
public int hashCode()Generate a unique hash code for all properties of thisMergedContextConfigurationexcluding the test class. -
toString
Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, the name of theContextLoader, and the parent configuration. -
processStrings
-
processClasses
-
processContextInitializerClasses
-
processContextCustomizers
private static Set<ContextCustomizer> processContextCustomizers(@Nullable Set<ContextCustomizer> contextCustomizers) -
processActiveProfiles
-
nullSafeClassName
Generate a null-safeStringrepresentation of the suppliedContextLoaderbased solely on the fully qualified name of the loader or "null" if the supplied loader isnull.
-