クラスの使用
org.springframework.test.context.MergedContextConfiguration
MergedContextConfiguration を使用するパッケージ
パッケージ
説明
このパッケージには Spring TestContext フレームワークが含まれており、使用中の実際のテストフレームワークにとらわれないアノテーション駆動型ユニットおよび統合テストのサポートを提供します。
Spring TestContext フレームワークの事前 (AOT) サポート。
Spring TestContext フレームワーク内のコンテキストキャッシングのサポート。
Spring TestContext フレームワークのサポートクラス。
Web は、Spring TestContext フレームワークのクラスをサポートします。
org.springframework.test.context 内の MergedContextConfiguration 使用
修飾子と型メソッド説明TestContextBootstrapper.buildMergedContextConfiguration()このブートストラップに関連付けられたBootstrapContext内のテストクラスのマージされたコンテキスト構成を構築します。MergedContextConfiguration.getParent()コンテキスト階層内の親アプリケーションコンテキストのMergedContextConfigurationを取得します。型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context のメソッド修飾子と型メソッド説明voidCacheAwareContextLoaderDelegate.closeContext(MergedContextConfiguration mergedConfig, DirtiesContext.HierarchyMode hierarchyMode) 提供されたMergedContextConfigurationのアプリケーションコンテキストをContextCacheから削除し、それがConfigurableApplicationContextのインスタンスである場合は閉じます。voidContextCustomizer.customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) Bean 定義がコンテキストになく、コンテキストがリフレッシュされた前にロードされた後に供給ConfigurableApplicationContextをカスタマイズします。default booleanCacheAwareContextLoaderDelegate.isContextLoaded(MergedContextConfiguration mergedConfig) CacheAwareContextLoaderDelegate.loadContext(MergedContextConfiguration mergedConfig) 指定されたMergedContextConfigurationで構成されたContextLoaderに委譲することにより、提供されたMergedContextConfigurationのアプリケーションコンテキストをロードします。SmartContextLoader.loadContext(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationに基づいて新しいApplicationContextをロードし、コンテキストを構成して、完全にリフレッシュされた状態でコンテキストを返します。型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context のコンストラクター修飾子コンストラクター説明MergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, StringSE[] propertySourceLocations, StringSE[] propertySourceProperties, SetSE<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) 使用すべきではありません。MergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, StringSE[] propertySourceLocations, StringSE[] propertySourceProperties, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) MergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, ListSE<PropertySourceDescriptor> propertySourceDescriptors, StringSE[] propertySourceProperties, SetSE<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) 指定されたパラメーターの新しいMergedContextConfigurationインスタンスを作成します。MergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) 指定されたパラメーターの新しいMergedContextConfigurationインスタンスを作成します。MergedContextConfiguration(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationからすべてのフィールドをコピーして、新しいMergedContextConfigurationインスタンスを作成します。org.springframework.test.context.aot 内の MergedContextConfiguration 使用
型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.aot のメソッド修飾子と型メソッド説明AotContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationに基づいて AOT ビルド時の処理用に新しいApplicationContextをロードし、コンテキストを構成して、コンテキストを返します。AotContextLoader.loadContextForAotRuntime(MergedContextConfiguration mergedConfig, ApplicationContextInitializer<ConfigurableApplicationContext> initializer) 提供されたMergedContextConfigurationおよびApplicationContextInitializerに基づいて、AOT ランタイム実行用に新しいApplicationContextをロードします。org.springframework.test.context.cache 内の MergedContextConfiguration 使用
型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.cache のメソッド修飾子と型メソッド説明voidDefaultCacheAwareContextLoaderDelegate.closeContext(MergedContextConfiguration mergedConfig, DirtiesContext.HierarchyMode hierarchyMode) booleanContextCache.contains(MergedContextConfiguration key) 指定されたキーのキャッシュされたコンテキストがあるかどうかを確認します。booleanDefaultContextCache.contains(MergedContextConfiguration key) ContextCache.get(MergedContextConfiguration key) 指定されたキーのキャッシュされたApplicationContextを取得します。DefaultContextCache.get(MergedContextConfiguration key) default intContextCache.getFailureCount(MergedContextConfiguration key) 指定されたキーの失敗回数を取得します。intDefaultContextCache.getFailureCount(MergedContextConfiguration key) default voidContextCache.incrementFailureCount(MergedContextConfiguration key) 指定されたキーの失敗回数を増やします。voidDefaultContextCache.incrementFailureCount(MergedContextConfiguration key) booleanDefaultCacheAwareContextLoaderDelegate.isContextLoaded(MergedContextConfiguration mergedConfig) DefaultCacheAwareContextLoaderDelegate.loadContext(MergedContextConfiguration mergedConfig) protected ApplicationContextDefaultCacheAwareContextLoaderDelegate.loadContextInternal(MergedContextConfiguration mergedConfig) 提供されたマージされたコンテキスト構成のApplicationContextをロードします。voidContextCache.put(MergedContextConfiguration key, ApplicationContext context) 特定のキーにあるApplicationContextインスタンスをキャッシュに明示的に追加します。これにより、カスタムの排除ポリシーが適用される可能性があります。voidDefaultContextCache.put(MergedContextConfiguration key, ApplicationContext context) voidContextCache.remove(MergedContextConfiguration key, DirtiesContext.HierarchyMode hierarchyMode) 指定されたキーを持つコンテキストをキャッシュから削除し、ConfigurableApplicationContextのインスタンスである場合は明示的に閉じます。voidDefaultContextCache.remove(MergedContextConfiguration key, DirtiesContext.HierarchyMode hierarchyMode) org.springframework.test.context.support 内の MergedContextConfiguration 使用
修飾子と型メソッド説明AbstractTestContextBootstrapper.buildMergedContextConfiguration()protected MergedContextConfigurationAbstractTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig) 提供され、新しくインスタンス化されたMergedContextConfigurationインスタンスを処理します。型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.support のメソッド修飾子と型メソッド説明protected voidAbstractContextLoader.customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) Bean 定義がコンテキストになく、文脈をリフレッシュされる前にロードされた後、このContextLoaderによって作成されたConfigurableApplicationContextをカスタマイズします。protected voidAbstractGenericContextLoader.loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationの場所またはクラスから、提供されたcontextに Bean 定義をロードします。protected voidAnnotationConfigContextLoader.loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationのクラスから、提供されたcontextのクラスを登録します。protected voidGenericGroovyXmlContextLoader.loadBeanDefinitions(GenericApplicationContext context, MergedContextConfiguration mergedConfig) GroovyBeanDefinitionReaderを使用して、提供されたMergedContextConfigurationの場所から提供されたcontextに Bean 定義をロードします。final ApplicationContextAbstractDelegatingSmartContextLoader.loadContext(MergedContextConfiguration mergedConfig) ApplicationContextをロードする適切な候補SmartContextLoaderにデリゲートします。final ApplicationContextAbstractGenericContextLoader.loadContext(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationのGenericApplicationContextをロードします。final ApplicationContextAbstractDelegatingSmartContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig) AOT 処理のためにApplicationContextをロードするために、適切な候補SmartContextLoaderに委譲します。AbstractGenericContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationに基づいて、AOT ビルド時の処理のためにGenericApplicationContextをロードします。final ApplicationContextAbstractDelegatingSmartContextLoader.loadContextForAotRuntime(MergedContextConfiguration mergedConfig, ApplicationContextInitializer<ConfigurableApplicationContext> initializer) AOT ランタイム実行のためにApplicationContextをロードするために、適切な候補SmartContextLoaderに委譲します。AbstractGenericContextLoader.loadContextForAotRuntime(MergedContextConfiguration mergedConfig, ApplicationContextInitializer<ConfigurableApplicationContext> initializer) 提供されたMergedContextConfigurationおよびApplicationContextInitializerに基づいて、AOT ランタイム実行用にGenericApplicationContextをロードします。protected voidAbstractContextLoader.prepareContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) Bean 定義が読み取られる前に、このSmartContextLoaderによって作成されたConfigurableApplicationContextを準備します。protected MergedContextConfigurationAbstractTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig) 提供され、新しくインスタンス化されたMergedContextConfigurationインスタンスを処理します。protected voidAbstractGenericContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) このコンテキストローダーがサポートするものに関して、提供されたMergedContextConfigurationを検証します。protected voidAnnotationConfigContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationにlocationsが含まれていないことを確認してください。protected voidGenericXmlContextLoader.validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationにclassesが含まれていないことを確認してください。型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.support のコンストラクター修飾子コンストラクター説明DefaultTestContext(ClassSE<?> testClass, MergedContextConfiguration mergedConfig, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) 指定された引数から新しいDefaultTestContextを構築します。org.springframework.test.context.web 内の MergedContextConfiguration 使用
修飾子と型クラス説明classWebMergedContextConfigurationは、テストクラスとそのすべてのスーパークラス、および@ContextConfiguration、@WebAppConfiguration、@ActiveProfiles、@TestPropertySourceを含むクラスで宣言されたマージされたコンテキスト構成をカプセル化します。修飾子と型メソッド説明protected MergedContextConfigurationWebTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig) 指定されたMergedContextConfigurationのテストクラスに@WebAppConfigurationのアノテーションが付けられている場合はWebMergedContextConfigurationを返し、それ以外の場合は指定されたインスタンスを変更せずに返します。型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.web のメソッド修飾子と型メソッド説明final ApplicationContextAbstractGenericWebContextLoader.loadContext(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationのGenericWebApplicationContextをロードします。AbstractGenericWebContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationに基づいて、AOT ビルド時の処理のためにGenericWebApplicationContextをロードします。AbstractGenericWebContextLoader.loadContextForAotRuntime(MergedContextConfiguration mergedConfig, ApplicationContextInitializer<ConfigurableApplicationContext> initializer) 提供されたMergedContextConfigurationおよびApplicationContextInitializerに基づいて、AOT ランタイム実行用にGenericWebApplicationContextをロードします。protected MergedContextConfigurationWebTestContextBootstrapper.processMergedContextConfiguration(MergedContextConfiguration mergedConfig) 指定されたMergedContextConfigurationのテストクラスに@WebAppConfigurationのアノテーションが付けられている場合はWebMergedContextConfigurationを返し、それ以外の場合は指定されたインスタンスを変更せずに返します。型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.web のコンストラクター修飾子コンストラクター説明WebMergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, StringSE[] propertySourceLocations, StringSE[] propertySourceProperties, StringSE resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) WebMergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, StringSE[] propertySourceLocations, StringSE[] propertySourceProperties, SetSE<ContextCustomizer> contextCustomizers, StringSE resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) WebMergedContextConfiguration(ClassSE<?> testClass, StringSE[] locations, ClassSE<?>[] classes, SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE[] activeProfiles, ListSE<PropertySourceDescriptor> propertySourceDescriptors, StringSE[] propertySourceProperties, SetSE<ContextCustomizer> contextCustomizers, StringSE resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, MergedContextConfiguration parent) 指定されたパラメーターの新しいWebMergedContextConfigurationインスタンスを作成します。WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, StringSE resourceBasePath) 提供されたMergedContextConfigurationからすべてのプロパティをコピーして、新しいWebMergedContextConfigurationインスタンスを作成します。
MergedContextConfiguration(Class, String[], Class[], Set, String[], List, String[], Set, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)を推奨