Class WebMergedContextConfiguration
- All Implemented Interfaces:
- Serializable
WebMergedContextConfiguration encapsulates the merged context
 configuration declared on a test class and all of its superclasses and
 enclosing classes via
 @ContextConfiguration,
 @WebAppConfiguration,
 @ActiveProfiles, and
 @TestPropertySource.
 WebMergedContextConfiguration extends the contract of
 MergedContextConfiguration by adding support for the resource base path configured via @WebAppConfiguration.
 This allows the ContextCache
 to properly cache the corresponding WebApplicationContext
 that was loaded using properties of this WebMergedContextConfiguration.
- Since:
- 3.2
- Author:
- Sam Brannen
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionWebMergedContextConfiguration(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) Deprecated.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) WebMergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, String[] activeProfiles, List<PropertySourceDescriptor> propertySourceDescriptors, 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.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanDetermine if the supplied object is equal to thisWebMergedContextConfigurationinstance by comparing both objects' locations, annotated classes, context initializer classes, active profiles, resource base paths, property source descriptors, property source properties, context customizers, parents, and the fully qualified names of theirContextLoaders.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.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, resource base path, the name of theContextLoader, and the parent configuration.Methods inherited from class org.springframework.test.context.MergedContextConfigurationgetActiveProfiles, getClasses, getContextCustomizers, getContextInitializerClasses, getContextLoader, getLocations, getParent, getParentApplicationContext, getPropertySourceDescriptors, getPropertySourceLocations, getPropertySourceProperties, getTestClass, hasClasses, hasLocations, hasResources, nullSafeClassName, processStrings
- 
Constructor Details- 
WebMergedContextConfigurationpublic 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.- Parameters:
- resourceBasePath- the resource path to the root directory of the web application
- Since:
- 4.1
 
- 
WebMergedContextConfiguration@Deprecated(since="6.1") 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) Deprecated.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.- Parameters:
- testClass- the test class for which the configuration was merged
- locations- the merged resource locations
- classes- the merged annotated classes
- contextInitializerClasses- the merged context initializer classes
- activeProfiles- the merged active bean definition profiles
- propertySourceLocations- the merged- PropertySourcelocations
- propertySourceProperties- the merged- PropertySourceproperties
- resourceBasePath- the resource path to the root directory of the web application
- contextLoader- the resolved- ContextLoader
- cacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent context
- parent- the parent configuration or- nullif there is no parent
- Since:
- 4.1
 
- 
WebMergedContextConfiguration@Deprecated(since="6.1") 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) Deprecated.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.- Parameters:
- testClass- the test class for which the configuration was merged
- locations- the merged context resource locations
- classes- the merged annotated classes
- contextInitializerClasses- the merged context initializer classes
- activeProfiles- the merged active bean definition profiles
- propertySourceLocations- the merged- PropertySourcelocations
- propertySourceProperties- the merged- PropertySourceproperties
- contextCustomizers- the context customizers
- resourceBasePath- the resource path to the root directory of the web application
- contextLoader- the resolved- ContextLoader
- cacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent context
- parent- the parent configuration or- nullif there is no parent
- Since:
- 4.3
 
- 
WebMergedContextConfigurationpublic WebMergedContextConfiguration(Class<?> testClass, @Nullable String[] locations, @Nullable Class<?>[] classes, @Nullable Set<Class<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, @Nullable String[] activeProfiles, List<PropertySourceDescriptor> propertySourceDescriptors, @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, 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.- Parameters:
- testClass- the test class for which the configuration was merged
- locations- the merged context resource locations
- classes- the merged annotated classes
- contextInitializerClasses- the merged context initializer classes
- activeProfiles- the merged active bean definition profiles
- propertySourceDescriptors- the merged property source descriptors
- propertySourceProperties- the merged inlined properties
- contextCustomizers- the context customizers
- resourceBasePath- the resource path to the root directory of the web application
- contextLoader- the resolved- ContextLoader
- cacheAwareContextLoaderDelegate- a cache-aware context loader delegate with which to retrieve the parent- ApplicationContext
- parent- the parent configuration or- nullif there is no parent
- Since:
- 6.1
 
 
- 
- 
Method Details- 
getResourceBasePathGet the resource path to the root directory of the web application for the test class, configured via@WebAppConfiguration.- See Also:
 
- 
equalsDetermine if the supplied object is equal to thisWebMergedContextConfigurationinstance by comparing both objects' locations, annotated classes, context initializer classes, active profiles, resource base paths, property source descriptors, property source properties, context customizers, parents, and the fully qualified names of theirContextLoaders.- Overrides:
- equalsin class- MergedContextConfiguration
 
- 
hashCodepublic int hashCode()Generate a unique hash code for all properties of thisWebMergedContextConfigurationexcluding the test class.- Overrides:
- hashCodein class- MergedContextConfiguration
 
- 
toStringProvide a String representation of the test class, locations, annotated classes, context initializer classes, active profiles, property source descriptors, property source properties, context customizers, resource base path, the name of theContextLoader, and the parent configuration.- Overrides:
- toStringin class- MergedContextConfiguration
 
 
- 
WebMergedContextConfiguration(Class, String[], Class[], Set, String[], List, String[], Set, String, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)