public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextLoader
AbstractGenericWebContextLoader の具体的な実装。 アノテーション付きクラスの定義については、@ContextConfiguration の Javadoc を参照してください。
メモ: AnnotationConfigWebContextLoader は、レガシー ContextLoader API によって定義された文字列ベースのリソースの場所ではなく、アノテーション付きのクラスをサポートします。AnnotationConfigWebContextLoader は AbstractGenericWebContextLoader を継承しますが、AnnotationConfigWebContextLoader は AbstractContextLoader または AbstractGenericWebContextLoader によって定義された文字列ベースのメソッドをサポートしません。AnnotationConfigWebContextLoader は主に ContextLoader ではなく SmartContextLoader と見なす必要があります。
| コンストラクターと説明 |
|---|
AnnotationConfigWebContextLoader() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected ClassSE<?>[] | detectDefaultConfigurationClasses(ClassSE<?> declaringClass) 提供されたテストクラスのデフォルトの構成クラスを検出します。 |
protected StringSE[] | generateDefaultLocations(ClassSE<?> clazz) |
protected StringSE | getResourceSuffix() |
protected void | loadBeanDefinitions(GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig) 提供された WebMergedContextConfiguration 内のクラスから、提供されたコンテキストにクラスを登録します。 |
protected StringSE[] | modifyLocations(ClassSE<?> clazz, StringSE... locations) |
void | processContextConfiguration(ContextConfigurationAttributes configAttributes) 提供された ContextConfigurationAttributes でアノテーション付きクラスを処理します。 |
protected void | validateMergedContextConfiguration(WebMergedContextConfiguration webMergedConfig) 提供された WebMergedContextConfiguration に locations が含まれていないことを確認してください。 |
configureWebResources, customizeBeanFactory, customizeContext, loadContext, loadContextcustomizeContext, getResourceSuffixes, isGenerateDefaultLocations, prepareContext, processLocationscloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic void processContextConfiguration(ContextConfigurationAttributes configAttributes)
ContextConfigurationAttributes でアノテーション付きクラスを処理します。 アノテーション付きクラスが null または空で、AbstractContextLoader.isGenerateDefaultLocations() が true を返す場合、この SmartContextLoader はデフォルトの構成クラスを検出しようとします。デフォルトが検出された場合、提供された構成属性に設定されます。それ以外の場合、提供された構成属性のプロパティは変更されません。
SmartContextLoader の processContextConfiguration AbstractContextLoader の processContextConfiguration configAttributes - 処理するコンテキスト構成属性 SmartContextLoader.processContextConfiguration(ContextConfigurationAttributes), AbstractContextLoader.isGenerateDefaultLocations(), detectDefaultConfigurationClasses(Class)protected ClassSE<?>[] detectDefaultConfigurationClasses(ClassSE<?> declaringClass)
デフォルトの実装は、単に AnnotationConfigContextLoaderUtils.detectDefaultConfigurationClasses(Class) に委譲するだけです。
declaringClass - @ContextConfiguration を宣言したテストクラス null はありません AnnotationConfigContextLoaderUtilsprotected StringSE[] modifyLocations(ClassSE<?> clazz, StringSE... locations)
AnnotationConfigWebContextLoader は、レガシー ContextLoader ではなく、SmartContextLoader として使用する必要があります。このメソッドはサポートされていません。AbstractContextLoader の modifyLocations clazz - 場所が関連付けられているクラス locations - 変更するリソースの場所 UnsupportedOperationExceptionSE - この実装 AbstractContextLoader.modifyLocations(java.lang.Class<?>, java.lang.String...)protected StringSE[] generateDefaultLocations(ClassSE<?> clazz)
AnnotationConfigWebContextLoader は、レガシー ContextLoader ではなく、SmartContextLoader として使用する必要があります。このメソッドはサポートされていません。AbstractContextLoader の generateDefaultLocations clazz - デフォルトの場所が生成されるクラス UnsupportedOperationExceptionSE - この実装 AbstractContextLoader.generateDefaultLocations(java.lang.Class<?>)protected StringSE getResourceSuffix()
AnnotationConfigWebContextLoader は、レガシー ContextLoader ではなく、SmartContextLoader として使用する必要があります。このメソッドはサポートされていません。AbstractContextLoader の getResourceSuffix null または空にしない UnsupportedOperationExceptionSE - この実装 AbstractContextLoader.getResourceSuffix()protected void loadBeanDefinitions(GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig)
WebMergedContextConfiguration 内のクラスから、提供されたコンテキストにクラスを登録します。 各クラスは、アノテーション付きクラスを表す必要があります。AnnotatedBeanDefinitionReader は、適切な Bean 定義を登録するために使用されます。
AbstractGenericWebContextLoader の loadBeanDefinitions context - アノテーション付きクラスを登録する必要があるコンテキスト webMergedConfig - クラスを取得するマージされた構成 AbstractGenericWebContextLoader.loadBeanDefinitions(org.springframework.web.context.support.GenericWebApplicationContext, org.springframework.test.context.web.WebMergedContextConfiguration)protected void validateMergedContextConfiguration(WebMergedContextConfiguration webMergedConfig)
WebMergedContextConfiguration に locations が含まれていないことを確認してください。AbstractGenericWebContextLoader の validateMergedContextConfiguration webMergedConfig - 検証するマージされた構成 AbstractGenericWebContextLoader.validateMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration)