类的使用
org.springframework.test.context.MergedContextConfiguration
使用MergedContextConfiguration的程序包 程序包 说明 org.springframework.test.context This package contains the Spring TestContext Framework which provides annotation-driven unit and integration testing support that is agnostic of the actual testing framework in use.org.springframework.test.context.cache Support for context caching within the Spring TestContext Framework.org.springframework.test.context.support Support classes for the Spring TestContext Framework.org.springframework.test.context.web Web support classes for the Spring TestContext Framework.org.springframework.test.context中MergedContextConfiguration的使用
返回MergedContextConfiguration的org.springframework.test.context中的方法 修饰符和类型 方法 说明 MergedContextConfigurationTestContextBootstrapper. buildMergedContextConfiguration()Build the merged context configuration for the test class in theBootstrapContextassociated with this bootstrapper.MergedContextConfigurationMergedContextConfiguration. getParent()Get theMergedContextConfigurationfor the parent application context in a context hierarchy.参数类型为MergedContextConfiguration的org.springframework.test.context中的方法 修饰符和类型 方法 说明 voidCacheAwareContextLoaderDelegate. closeContext(MergedContextConfiguration mergedContextConfiguration, DirtiesContext.HierarchyMode hierarchyMode)Remove the application context for the suppliedMergedContextConfigurationfrom theContextCacheand close it if it is an instance ofConfigurableApplicationContext.voidContextCustomizer. customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig)Customize the suppliedConfigurableApplicationContextafter bean definitions have been loaded into the context but before the context has been refreshed.default booleanCacheAwareContextLoaderDelegate. isContextLoaded(MergedContextConfiguration mergedContextConfiguration)Determine if the application context for the suppliedMergedContextConfigurationhas been loaded (i.e., is present in theContextCache).ApplicationContextCacheAwareContextLoaderDelegate. loadContext(MergedContextConfiguration mergedContextConfiguration)Load the application context for the suppliedMergedContextConfigurationby delegating to theContextLoaderconfigured in the givenMergedContextConfiguration.ApplicationContextSmartContextLoader. loadContext(MergedContextConfiguration mergedConfig)Loads a newcontextbased on the suppliedmerged context configuration, configures the context, and finally returns the context in a fully refreshed state.参数类型为MergedContextConfiguration的org.springframework.test.context中的构造器 构造器 说明 MergedContextConfiguration(Class<?> testClass, String[] locations, Class<?>[] classes, Set<Class<? extends 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 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 ApplicationContextInitializer<?>>> contextInitializerClasses, String[] activeProfiles, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent)Create a newMergedContextConfigurationinstance for the supplied parameters.MergedContextConfiguration(MergedContextConfiguration mergedConfig)Create a newMergedContextConfigurationinstance by copying all fields from the suppliedMergedContextConfiguration.org.springframework.test.context.cache中MergedContextConfiguration的使用
参数类型为MergedContextConfiguration的org.springframework.test.context.cache中的方法 修饰符和类型 方法 说明 voidDefaultCacheAwareContextLoaderDelegate. closeContext(MergedContextConfiguration mergedContextConfiguration, DirtiesContext.HierarchyMode hierarchyMode)booleanContextCache. contains(MergedContextConfiguration key)Determine whether there is a cached context for the given key.booleanDefaultContextCache. contains(MergedContextConfiguration key)Determine whether there is a cached context for the given key.ApplicationContextContextCache. get(MergedContextConfiguration key)Obtain a cachedApplicationContextfor the given key.ApplicationContextDefaultContextCache. get(MergedContextConfiguration key)Obtain a cachedApplicationContextfor the given key.booleanDefaultCacheAwareContextLoaderDelegate. isContextLoaded(MergedContextConfiguration mergedContextConfiguration)ApplicationContextDefaultCacheAwareContextLoaderDelegate. loadContext(MergedContextConfiguration mergedContextConfiguration)protected ApplicationContextDefaultCacheAwareContextLoaderDelegate. loadContextInternal(MergedContextConfiguration mergedContextConfiguration)Load theApplicationContextfor the supplied merged context configuration.voidContextCache. put(MergedContextConfiguration key, ApplicationContext context)Explicitly add anApplicationContextinstance to the cache under the given key, potentially honoring a custom eviction policy.voidDefaultContextCache. put(MergedContextConfiguration key, ApplicationContext context)Explicitly add anApplicationContextinstance to the cache under the given key, potentially honoring a custom eviction policy.voidContextCache. remove(MergedContextConfiguration key, DirtiesContext.HierarchyMode hierarchyMode)Remove the context with the given key from the cache and explicitly close it if it is an instance ofConfigurableApplicationContext.voidDefaultContextCache. remove(MergedContextConfiguration key, DirtiesContext.HierarchyMode hierarchyMode)Remove the context with the given key from the cache and explicitly close it if it is an instance ofConfigurableApplicationContext.org.springframework.test.context.support中MergedContextConfiguration的使用
返回MergedContextConfiguration的org.springframework.test.context.support中的方法 修饰符和类型 方法 说明 MergedContextConfigurationAbstractTestContextBootstrapper. buildMergedContextConfiguration()Build the merged context configuration for the test class in theBootstrapContextassociated with this bootstrapper.protected MergedContextConfigurationAbstractTestContextBootstrapper. processMergedContextConfiguration(MergedContextConfiguration mergedConfig)Process the supplied, newly instantiatedMergedContextConfigurationinstance.参数类型为MergedContextConfiguration的org.springframework.test.context.support中的方法 修饰符和类型 方法 说明 protected voidAbstractContextLoader. customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig)Customize theConfigurableApplicationContextcreated by thisContextLoaderafter bean definitions have been loaded into the context but before the context has been refreshed.protected voidAbstractGenericContextLoader. loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig)Load bean definitions into the suppliedcontextfrom the locations or classes in the suppliedMergedContextConfiguration.protected voidAnnotationConfigContextLoader. loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig)Register classes in the suppliedcontextfrom the classes in the suppliedMergedContextConfiguration.protected voidGenericGroovyXmlContextLoader. loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig)Load bean definitions into the suppliedcontextfrom the locations in the suppliedMergedContextConfigurationusing aGroovyBeanDefinitionReader.ApplicationContextAbstractDelegatingSmartContextLoader. loadContext(MergedContextConfiguration mergedConfig)Delegates to an appropriate candidateSmartContextLoaderto load anApplicationContext.ConfigurableApplicationContextAbstractGenericContextLoader. loadContext(MergedContextConfiguration mergedConfig)Load a Spring ApplicationContext from the suppliedMergedContextConfiguration.protected voidAbstractContextLoader. prepareContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig)Prepare theConfigurableApplicationContextcreated by thisSmartContextLoaderbefore bean definitions are read.protected MergedContextConfigurationAbstractTestContextBootstrapper. processMergedContextConfiguration(MergedContextConfiguration mergedConfig)Process the supplied, newly instantiatedMergedContextConfigurationinstance.protected voidAbstractGenericContextLoader. validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)Validate the suppliedMergedContextConfigurationwith respect to what this context loader supports.protected voidAnnotationConfigContextLoader. validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)Ensure that the suppliedMergedContextConfigurationdoes not containlocations.protected voidGenericPropertiesContextLoader. validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)Ensure that the suppliedMergedContextConfigurationdoes not containclasses.protected voidGenericXmlContextLoader. validateMergedContextConfiguration(MergedContextConfiguration mergedConfig)Ensure that the suppliedMergedContextConfigurationdoes not containclasses.参数类型为MergedContextConfiguration的org.springframework.test.context.support中的构造器 构造器 说明 DefaultTestContext(Class<?> testClass, MergedContextConfiguration mergedContextConfiguration, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate)Construct a newDefaultTestContextfrom the supplied arguments.org.springframework.test.context.web中MergedContextConfiguration的使用
org.springframework.test.context.web中MergedContextConfiguration的子类 修饰符和类型 类 说明 classWebMergedContextConfigurationWebMergedContextConfigurationencapsulates the merged context configuration declared on a test class and all of its superclasses via@ContextConfiguration,@WebAppConfiguration, and@ActiveProfiles.返回MergedContextConfiguration的org.springframework.test.context.web中的方法 修饰符和类型 方法 说明 protected MergedContextConfigurationWebTestContextBootstrapper. processMergedContextConfiguration(MergedContextConfiguration mergedConfig)Returns aWebMergedContextConfigurationif the test class in the suppliedMergedContextConfigurationis annotated with@WebAppConfigurationand otherwise returns the supplied instance unmodified.参数类型为MergedContextConfiguration的org.springframework.test.context.web中的方法 修饰符和类型 方法 说明 ConfigurableApplicationContextAbstractGenericWebContextLoader. loadContext(MergedContextConfiguration mergedConfig)Load a SpringWebApplicationContextfrom the suppliedMergedContextConfiguration.protected MergedContextConfigurationWebTestContextBootstrapper. processMergedContextConfiguration(MergedContextConfiguration mergedConfig)Returns aWebMergedContextConfigurationif the test class in the suppliedMergedContextConfigurationis annotated with@WebAppConfigurationand otherwise returns the supplied instance unmodified.参数类型为MergedContextConfiguration的org.springframework.test.context.web中的构造器 构造器 说明 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.