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