类 WebMergedContextConfiguration
- java.lang.Object
- org.springframework.test.context.MergedContextConfiguration
- org.springframework.test.context.web.WebMergedContextConfiguration
- 所有已实现的接口:
Serializable
public class WebMergedContextConfiguration extends MergedContextConfiguration
WebMergedContextConfiguration
encapsulates the merged context configuration declared on a test class and all of its superclasses via@ContextConfiguration
,@WebAppConfiguration
, and@ActiveProfiles
.WebMergedContextConfiguration
extends the contract ofMergedContextConfiguration
by adding support for theresource base path
configured via@WebAppConfiguration
. This allows theTestContext
to properly cache the correspondingWebApplicationContext
that was loaded using properties of thisWebMergedContextConfiguration
.
构造器概要
构造器 构造器 说明 WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)
Create a newWebMergedContextConfiguration
instance for the supplied parameters.WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)
Create a newWebMergedContextConfiguration
instance for the supplied parameters.WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)
WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, String resourceBasePath)
Create a newWebMergedContextConfiguration
instance by copying all properties from the suppliedMergedContextConfiguration
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
equals(Object other)
Determine if the supplied object is equal to thisWebMergedContextConfiguration
instance by comparing both object's locations, annotated classes, context initializer classes, active profiles, resource base path, parents, and the fully qualified names of theirContextLoaders
.String
getResourceBasePath()
Get the resource path to the root directory of the web application for the test class, configured via@WebAppConfiguration
.int
hashCode()
Generate a unique hash code for all properties of thisWebMergedContextConfiguration
excluding the test class.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.从类继承的方法 org.springframework.test.context.MergedContextConfiguration
getActiveProfiles, getClasses, getContextCustomizers, getContextInitializerClasses, getContextLoader, getLocations, getParent, getParentApplicationContext, getPropertySourceLocations, getPropertySourceProperties, getTestClass, hasClasses, hasLocations, hasResources, nullSafeToString
构造器详细资料
WebMergedContextConfiguration
@Deprecated public WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)
已过时。Create a newWebMergedContextConfiguration
instance for the supplied parameters.- 参数:
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 profilesresourceBasePath
- the resource path to the root directory of the web applicationcontextLoader
- the resolvedContextLoader
cacheAwareContextLoaderDelegate
- a cache-aware context loader delegate with which to retrieve the parent contextparent
- the parent configuration ornull
if there is no parent- 从以下版本开始:
- 3.2.2
WebMergedContextConfiguration
public WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, String resourceBasePath)
Create a newWebMergedContextConfiguration
instance by copying all properties from the suppliedMergedContextConfiguration
.If an empty value is supplied for the
resourceBasePath
an empty string will be used.- 参数:
resourceBasePath
- the resource path to the root directory of the web application- 从以下版本开始:
- 4.1
WebMergedContextConfiguration
public WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)
Create a newWebMergedContextConfiguration
instance for the supplied parameters.If a
null
value is supplied forlocations
,classes
,activeProfiles
,propertySourceLocations
, orpropertySourceProperties
an empty array will be stored instead. If anull
value is supplied for thecontextInitializerClasses
an empty set will be stored instead. If an empty value is supplied for theresourceBasePath
an 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 mergedPropertySource
locationspropertySourceProperties
- the mergedPropertySource
propertiesresourceBasePath
- the resource path to the root directory of the web applicationcontextLoader
- the resolvedContextLoader
cacheAwareContextLoaderDelegate
- a cache-aware context loader delegate with which to retrieve the parent contextparent
- the parent configuration ornull
if there is no parent- 从以下版本开始:
- 4.1
WebMergedContextConfiguration
public WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> contextInitializerClasses, String[] activeProfiles, String[] propertySourceLocations, String[] propertySourceProperties, Set<ContextCustomizer> contextCustomizers, String resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)
Create a newWebMergedContextConfiguration
instance for the supplied parameters.If a
null
value is supplied forlocations
,classes
,activeProfiles
,propertySourceLocations
, orpropertySourceProperties
an empty array will be stored instead. If anull
value is supplied forcontextInitializerClasses
orcontextCustomizers
, an empty set will be stored instead. If an empty value is supplied for theresourceBasePath
an 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 mergedPropertySource
locationspropertySourceProperties
- the mergedPropertySource
propertiescontextCustomizers
- the context customizersresourceBasePath
- the resource path to the root directory of the web applicationcontextLoader
- the resolvedContextLoader
cacheAwareContextLoaderDelegate
- a cache-aware context loader delegate with which to retrieve the parent contextparent
- the parent configuration ornull
if 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(Object other)
Determine if the supplied object is equal to thisWebMergedContextConfiguration
instance 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 thisWebMergedContextConfiguration
excluding 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.