クラスの使用
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, @Nullable 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をロードし、コンテキストを構成して、完全にリフレッシュされた状態でコンテキストを返します。default voidCacheAwareContextLoaderDelegate.registerContextUsage(MergedContextConfiguration key, ClassSE<?> testClass) default voidCacheAwareContextLoaderDelegate.unregisterContextUsage(MergedContextConfiguration key, ClassSE<?> testClass) 型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context のコンストラクター修飾子コンストラクター説明MergedContextConfiguration(ClassSE<?> testClass, StringSE @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, StringSE @Nullable [] propertySourceLocations, StringSE @Nullable [] propertySourceProperties, @Nullable SetSE<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) 使用すべきではありません。MergedContextConfiguration(ClassSE<?> testClass, StringSE @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, StringSE @Nullable [] propertySourceLocations, StringSE @Nullable [] propertySourceProperties, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) MergedContextConfiguration(ClassSE<?> testClass, StringSE @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, ListSE<PropertySourceDescriptor> propertySourceDescriptors, StringSE @Nullable [] propertySourceProperties, @Nullable SetSE<ContextCustomizer> contextCustomizers, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) 指定されたパラメーターの新しいMergedContextConfigurationインスタンスを作成します。MergedContextConfiguration(ClassSE<?> testClass, StringSE @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, ContextLoader contextLoader, @Nullable CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) 指定されたパラメーターの新しいMergedContextConfigurationインスタンスを作成します。MergedContextConfiguration(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationからすべてのフィールドをコピーして、新しいMergedContextConfigurationインスタンスを作成します。org.springframework.test.context.aot 内の MergedContextConfiguration 使用
型 MergedContextConfiguration のパラメーターを持つ org.springframework.test.context.aot のメソッド修飾子と型メソッド説明default ApplicationContextAotContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。Spring Framework 6.2.4 時点ではAotContextLoader.loadContextForAotProcessing(MergedContextConfiguration, RuntimeHints)に置き換えられ、Spring Framework 8.0 で削除される予定default ApplicationContextAotContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig, RuntimeHints runtimeHints) 提供された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, @Nullable 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) ContextCache.LoadFunction.loadContext(MergedContextConfiguration mergedConfig) 提供されたMergedContextConfigurationに基づいて新しいApplicationContextをロードし、完全にリフレッシュされた状態のコンテキストを返します。DefaultCacheAwareContextLoaderDelegate.loadContext(MergedContextConfiguration mergedConfig) protected ApplicationContextDefaultCacheAwareContextLoaderDelegate.loadContextInternal(MergedContextConfiguration mergedConfig) 提供されたマージされたコンテキスト構成のApplicationContextをロードします。voidContextCache.put(MergedContextConfiguration key, ApplicationContext context) 使用すべきではありません。Spring Framework 7.0 からContextCache.put(MergedContextConfiguration, LoadFunction)を推奨default ApplicationContextContextCache.put(MergedContextConfiguration key, ContextCache.LoadFunction loadFunction) 指定されたキーのキャッシュにApplicationContextを明示的に追加し、カスタム削除ポリシーを尊重する可能性があります。voidDefaultContextCache.put(MergedContextConfiguration key, ApplicationContext context) 使用すべきではありません。DefaultContextCache.put(MergedContextConfiguration key, ContextCache.LoadFunction loadFunction) default voidContextCache.registerContextUsage(MergedContextConfiguration key, ClassSE<?> testClass) 提供されたMergedContextConfigurationとその親のいずれかに対してApplicationContextの使用を登録します。voidDefaultCacheAwareContextLoaderDelegate.registerContextUsage(MergedContextConfiguration mergedConfig, ClassSE<?> testClass) voidDefaultContextCache.registerContextUsage(MergedContextConfiguration mergedConfig, ClassSE<?> testClass) voidContextCache.remove(MergedContextConfiguration key, @Nullable DirtiesContext.HierarchyMode hierarchyMode) 指定されたキーを持つコンテキストをキャッシュから削除し、ConfigurableApplicationContextのインスタンスである場合は明示的に閉じます。voidDefaultContextCache.remove(MergedContextConfiguration key, @Nullable DirtiesContext.HierarchyMode hierarchyMode) default voidContextCache.unregisterContextUsage(MergedContextConfiguration key, ClassSE<?> testClass) 指定されたMergedContextConfigurationとその親のApplicationContextの使用を登録解除します。voidDefaultCacheAwareContextLoaderDelegate.unregisterContextUsage(MergedContextConfiguration mergedConfig, ClassSE<?> testClass) voidDefaultContextCache.unregisterContextUsage(MergedContextConfiguration mergedConfig, ClassSE<?> testClass) 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) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。Spring Framework 6.2.4 時点ではAbstractDelegatingSmartContextLoader.loadContextForAotProcessing(MergedContextConfiguration, RuntimeHints)に置き換えられ、Spring Framework 8.0 で削除される予定final ApplicationContextAbstractDelegatingSmartContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig, RuntimeHints runtimeHints) AOT 処理のためにApplicationContextをロードするために、適切な候補SmartContextLoaderに委譲します。AbstractGenericContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。Spring Framework 6.2.4 時点ではAbstractGenericContextLoader.loadContextForAotProcessing(MergedContextConfiguration, RuntimeHints)に置き換えられ、Spring Framework 8.0 で削除される予定AbstractGenericContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig, RuntimeHints runtimeHints) 提供された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) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。Spring Framework 6.2.4 時点ではAbstractGenericWebContextLoader.loadContextForAotProcessing(MergedContextConfiguration, RuntimeHints)に置き換えられ、Spring Framework 8.0 で削除される予定AbstractGenericWebContextLoader.loadContextForAotProcessing(MergedContextConfiguration mergedConfig, RuntimeHints runtimeHints) 提供された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 @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, StringSE @Nullable [] propertySourceLocations, StringSE @Nullable [] propertySourceProperties, StringSE resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) WebMergedContextConfiguration(ClassSE<?> testClass, StringSE @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, StringSE @Nullable [] propertySourceLocations, StringSE @Nullable [] propertySourceProperties, @Nullable SetSE<ContextCustomizer> contextCustomizers, StringSE resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) WebMergedContextConfiguration(ClassSE<?> testClass, StringSE @Nullable [] locations, ClassSE<?> @Nullable [] classes, @Nullable SetSE<ClassSE<? extends ApplicationContextInitializer<?>>> contextInitializerClasses, StringSE @Nullable [] activeProfiles, ListSE<PropertySourceDescriptor> propertySourceDescriptors, StringSE @Nullable [] propertySourceProperties, @Nullable SetSE<ContextCustomizer> contextCustomizers, StringSE resourceBasePath, ContextLoader contextLoader, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate, @Nullable MergedContextConfiguration parent) 指定されたパラメーターの新しいWebMergedContextConfigurationインスタンスを作成します。WebMergedContextConfiguration(MergedContextConfiguration mergedConfig, StringSE resourceBasePath) 提供されたMergedContextConfigurationからすべてのプロパティをコピーして、新しいWebMergedContextConfigurationインスタンスを作成します。
MergedContextConfiguration(Class, String[], Class[], Set, String[], List, String[], Set, ContextLoader, CacheAwareContextLoaderDelegate, MergedContextConfiguration)を推奨