类 WebMergedContextConfiguration
- java.lang.Object
- org.springframework.test.context.MergedContextConfiguration
- org.springframework.test.context.web.WebMergedContextConfiguration
- 所有已实现的接口:
Serializable
public class WebMergedContextConfiguration extends MergedContextConfiguration
WebMergedContextConfigurationencapsulates the merged context configuration declared on a test class and all of its superclasses via@ContextConfiguration,@WebAppConfiguration, and@ActiveProfiles.WebMergedContextConfigurationextends the contract ofMergedContextConfigurationby adding support for theresource base pathconfigured via@WebAppConfiguration. This allows theTestContextto properly cache the correspondingWebApplicationContextthat was loaded using properties of thisWebMergedContextConfiguration.
构造器概要
构造器 构造器 说明 WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)Create a newWebMergedContextConfigurationinstance for the supplied parameters.WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)Create a newWebMergedContextConfigurationinstance for the supplied parameters.WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, String resourceBasePath)Create a newWebMergedContextConfigurationinstance by copying all properties from the suppliedMergedContextConfiguration.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanequals(Object other)Determine if the supplied object is equal to thisWebMergedContextConfigurationinstance by comparing both object's locations, annotated classes, context initializer classes, active profiles, resource base path, parents, and the fully qualified names of theirContextLoaders.StringgetResourceBasePath()Get the resource path to the root directory of the web application for the test class, configured via@WebAppConfiguration.inthashCode()Generate a unique hash code for all properties of thisWebMergedContextConfigurationexcluding the test class.StringtoString()Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source locations, property source properties, context customizers, resource base path, the name of theContextLoader, and the parent configuration.从类继承的方法 org.springframework.test.context.MergedContextConfiguration
getActiveProfiles, getClasses, getContextCustomizers, getContextInitializerClasses, getContextLoader, getLocations, getParent, getParentApplicationContext, getPropertySourceLocations, getPropertySourceProperties, getTestClass, hasClasses, hasLocations, hasResources, nullSafeClassName
构造器详细资料
WebMergedContextConfiguration
public WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, String resourceBasePath)
Create a newWebMergedContextConfigurationinstance by copying all properties from the suppliedMergedContextConfiguration.If an empty value is supplied for the
resourceBasePathan empty string will be used.- 参数:
resourceBasePath- the resource path to the root directory of the web application- 从以下版本开始:
- 4.1
WebMergedContextConfiguration
public WebMergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, @Nullable String[] activeProfiles, @Nullable String[] propertySourceLocations, @Nullable String[] propertySourceProperties, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent)
Create a newWebMergedContextConfigurationinstance 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. If an empty value is supplied for theresourceBasePathan empty string will be used. Furthermore, active profiles will be sorted, and duplicate profiles will be removed.- 参数:
testClass- the test class for which the configuration was mergedlocations- the merged resource locationsclasses- the merged annotated classescontextInitializerClasses- the merged context initializer classesactiveProfiles- the merged active bean definition profilespropertySourceLocations- the mergedPropertySourcelocationspropertySourceProperties- the mergedPropertySourcepropertiesresourceBasePath- the resource path to the root directory of the web applicationcontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent contextparent- the parent configuration ornullif there is no parent- 从以下版本开始:
- 4.1
WebMergedContextConfiguration
public WebMergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, @Nullable String[] activeProfiles, @Nullable String[] propertySourceLocations, @Nullable String[] propertySourceProperties, @Nullable Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent)
Create a newWebMergedContextConfigurationinstance 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. If an empty value is supplied for theresourceBasePathan empty string will be used. 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 customizersresourceBasePath- the resource path to the root directory of the web applicationcontextLoader- the resolvedContextLoadercacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent contextparent- the parent configuration ornullif there is no parent- 从以下版本开始:
- 4.3
方法详细资料
getResourceBasePath
public String getResourceBasePath()
Get the resource path to the root directory of the web application for the test class, configured via@WebAppConfiguration.- 另请参阅:
WebAppConfiguration
equals
public boolean equals(@Nullable Object other)
Determine if the supplied object is equal to thisWebMergedContextConfigurationinstance by comparing both object's locations, annotated classes, context initializer classes, active profiles, resource base path, parents, and the fully qualified names of theirContextLoaders.- 覆盖:
equals在类中MergedContextConfiguration
hashCode
public int hashCode()
Generate a unique hash code for all properties of thisWebMergedContextConfigurationexcluding the test class.
toString
public String toString()
Provide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source locations, property source properties, context customizers, resource base path, the name of theContextLoader, and the parent configuration.