クラス SpringBootTestContextBootstrapper
java.lang.ObjectSE
org.springframework.test.context.support.AbstractTestContextBootstrapper
org.springframework.test.context.support.DefaultTestContextBootstrapper
org.springframework.boot.test.context.SpringBootTestContextBootstrapper
- 実装されているすべてのインターフェース:
TestContextBootstrapper
Spring Boot の
TestContextBootstrapper。@SpringBootTest のサポートを提供し、直接使用またはサブクラス化することもできます。DefaultTestContextBootstrapper に加えて、次の機能を提供します。default context loaderとしてSpringBootContextLoaderを使用します。- 必要に応じて
@SpringBootConfigurationを自動的に検索します。 - カスタム
EnvironmentgetProperties(Class)を定義できます。 - さまざまな
webEnvironmentモードをサポートします。
- 導入:
- 1.4.0
- 作成者:
- Phillip Webb, Andy Wilkinson, Brian Clozel, Madhura Bhave, Lorenzo Dee
- 関連事項:
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明protected final MergedContextConfigurationcreateModifiedConfig(MergedContextConfiguration mergedConfig, ClassSE<?>[] classes) 異なるクラスで新しいMergedContextConfigurationを作成します。protected final MergedContextConfigurationcreateModifiedConfig(MergedContextConfiguration mergedConfig, ClassSE<?>[] classes, StringSE[] propertySourceProperties) 異なるクラスとプロパティで新しいMergedContextConfigurationを作成します。protected StringSEdetermineResourceBasePath(MergedContextConfiguration configuration) 指定されたconfigurationのテストクラスに@WebAppConfiguration(存在する場合)の値を使用して、Web アプリケーションのリソースベースパスを決定します。protected SpringBootTestgetAnnotation(ClassSE<?> testClass) protected ClassSE<?>[]getClasses(ClassSE<?> testClass) protected ClassSE<? extends ContextLoader>getDefaultContextLoaderClass(ClassSE<?> testClass) protected StringSE"differentiator" プロパティを返して、通常のテストとブートストラップテストを区別する何かがあることを確認します。protected ClassSE<?>[]getOrFindConfigurationClasses(MergedContextConfiguration mergedConfig) protected StringSE[]getProperties(ClassSE<?> testClass) protected SpringBootTest.WebEnvironmentgetWebEnvironment(ClassSE<?> testClass) このテストのSpringBootTest.WebEnvironment型を返すか、未定義の場合は null を返します。protected MergedContextConfigurationprocessMergedContextConfiguration(MergedContextConfiguration mergedConfig) protected voidprocessPropertySourceProperties(MergedContextConfiguration mergedConfig, ListSE<StringSE> propertySourceProperties) プロパティソースプロパティを後処理し、必要に応じて要素を追加または削除します。protected ContextLoaderresolveContextLoader(ClassSE<?> testClass, ListSE<ContextConfigurationAttributes> configAttributesList) protected voidverifyConfiguration(ClassSE<?> testClass) クラス org.springframework.test.context.support.AbstractTestContextBootstrapper から継承されたメソッド
buildMergedContextConfiguration, getBootstrapContext, getCacheAwareContextLoaderDelegate, getContextCustomizerFactories, getDefaultTestExecutionListeners, getTestExecutionListeners, resolveExplicitContextLoaderClass, setBootstrapContext
コンストラクターの詳細
SpringBootTestContextBootstrapper
public SpringBootTestContextBootstrapper()
メソッドの詳細
buildTestContext
- 次で指定:
- インターフェース
TestContextBootstrapperのbuildTestContext - オーバーライド:
- クラス
AbstractTestContextBootstrapperのbuildTestContext
resolveContextLoader
protected ContextLoader resolveContextLoader(ClassSE<?> testClass, ListSE<ContextConfigurationAttributes> configAttributesList) - オーバーライド:
- クラス
AbstractTestContextBootstrapperのresolveContextLoader
getDefaultContextLoaderClass
- オーバーライド:
- クラス
DefaultTestContextBootstrapperのgetDefaultContextLoaderClass
processMergedContextConfiguration
protected MergedContextConfiguration processMergedContextConfiguration(MergedContextConfiguration mergedConfig) - オーバーライド:
- クラス
AbstractTestContextBootstrapperのprocessMergedContextConfiguration
determineResourceBasePath
指定されたconfigurationのテストクラスに@WebAppConfiguration(存在する場合)の値を使用して、Web アプリケーションのリソースベースパスを決定します。存在しない場合のデフォルトはsrc/main/webappです。- パラメーター:
configuration- 調べる構成- 戻り値:
- リソースの基本パス
- 導入:
- 2.1.6
getOrFindConfigurationClasses
getDifferentiatorPropertySourceProperty
"differentiator" プロパティを返して、通常のテストとブートストラップテストを区別する何かがあることを確認します。このプロパティがないと、このブートストラップによって作成されなかったキャッシュされたコンテキストが返される可能性があります。デフォルトでは、プロパティとしてブートストラップクラスを使用します。- 戻り値:
- 差別化要因または
null
processPropertySourceProperties
protected void processPropertySourceProperties(MergedContextConfiguration mergedConfig, ListSE<StringSE> propertySourceProperties) プロパティソースプロパティを後処理し、必要に応じて要素を追加または削除します。- パラメーター:
mergedConfig- マージされたコンテキスト構成propertySourceProperties- 処理するプロパティソースプロパティ
getWebEnvironment
このテストのSpringBootTest.WebEnvironment型を返すか、未定義の場合は null を返します。- パラメーター:
testClass- ソーステストクラス- 戻り値:
SpringBootTest.WebEnvironmentまたはnull
getClasses
getProperties
getAnnotation
verifyConfiguration
createModifiedConfig
protected final MergedContextConfiguration createModifiedConfig(MergedContextConfiguration mergedConfig, ClassSE<?>[] classes) 異なるクラスで新しいMergedContextConfigurationを作成します。- パラメーター:
mergedConfig- ソース構成classes- 置換クラス- 戻り値:
- 新しい
MergedContextConfiguration
createModifiedConfig
protected final MergedContextConfiguration createModifiedConfig(MergedContextConfiguration mergedConfig, ClassSE<?>[] classes, StringSE[] propertySourceProperties) 異なるクラスとプロパティで新しいMergedContextConfigurationを作成します。- パラメーター:
mergedConfig- ソース構成classes- 置換クラスpropertySourceProperties- 置換プロパティ- 戻り値:
- 新しい
MergedContextConfiguration