public class SpringBootContextLoader extends AbstractContextLoader
SpringApplication
を使用して起動するアプリケーション)のテストに使用できる ContextLoader
。このローダーは直接使用できますが、ほとんどのテストでは SpringBootTest
と一緒に使用する必要があります。 ローダーは、標準の MergedContextConfiguration
と WebMergedContextConfiguration
の両方をサポートしています。WebMergedContextConfiguration
を使用する場合、コンテキストはモックサーブレット環境を使用するか、完全な組み込み Web サーバーを起動します。
@ActiveProfiles
がテストクラスで提供されている場合、アプリケーションコンテキストの作成に使用されます。
SpringBootTest
コンストラクターと説明 |
---|
SpringBootContextLoader() |
修飾子と型 | メソッドと説明 |
---|---|
protected ClassSE<?>[] | detectDefaultConfigurationClasses(ClassSE<?> declaringClass) 提供されたテストクラスのデフォルトの構成クラスを検出します。 |
protected ConfigurableEnvironment | getEnvironment() 新しい ConfigurableEnvironment インスタンスを作成します。 |
protected ListSE<ApplicationContextInitializer<?>> | getInitializers(MergedContextConfiguration config, SpringApplication application) コンテキストに適用される initializers を返します。 |
protected StringSE[] | getInlinedProperties(MergedContextConfiguration config) |
protected StringSE | getResourceSuffix() |
protected StringSE[] | getResourceSuffixes() |
protected SpringApplication | getSpringApplication() 新しい SpringApplication インスタンスを作成します。 |
ApplicationContext | loadContext(MergedContextConfiguration config) |
ApplicationContext | loadContext(StringSE... locations) |
void | processContextConfiguration(ContextConfigurationAttributes configAttributes) |
customizeContext, generateDefaultLocations, isGenerateDefaultLocations, modifyLocations, prepareContext, processLocations
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public ApplicationContext loadContext(MergedContextConfiguration config) throws ExceptionSE
ExceptionSE
protected SpringApplication getSpringApplication()
SpringApplication
インスタンスを作成します。このメソッドをオーバーライドしてカスタム動作を追加できます SpringApplication
インスタンス protected ConfigurableEnvironment getEnvironment()
ConfigurableEnvironment
インスタンスを作成します。必要に応じて、このメソッドをオーバーライドして、StandardEnvironment
以外のものを返すことができます。ConfigurableEnvironment
インスタンス protected StringSE[] getInlinedProperties(MergedContextConfiguration config)
protected ListSE<ApplicationContextInitializer<?>> getInitializers(MergedContextConfiguration config, SpringApplication application)
initializers
を返します。デフォルトでは、このメソッドは context customizers
を適応させ、application initializers
を追加し、initializers specified on the test
を追加します。config
- ソースコンテキスト構成 application
- アプリケーションインスタンス public void processContextConfiguration(ContextConfigurationAttributes configAttributes)
SmartContextLoader
の processContextConfiguration
AbstractContextLoader
の processContextConfiguration
protected ClassSE<?>[] detectDefaultConfigurationClasses(ClassSE<?> declaringClass)
AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(java.lang.Class<?>)
に委譲します。declaringClass
- @ContextConfiguration
を宣言したテストクラス null
はありません AnnotationConfigContextLoaderUtils
public ApplicationContext loadContext(StringSE... locations) throws ExceptionSE
ExceptionSE
protected StringSE[] getResourceSuffixes()
AbstractContextLoader
の getResourceSuffixes
protected StringSE getResourceSuffix()
AbstractContextLoader
の getResourceSuffix
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.