From a16f3ba9dc79f57525e924e7c018d2124e46332d Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 9 Apr 2011 23:24:34 +0000 Subject: [PATCH] [SPR-6184] completed JavaDoc for AnnotationConfigContextLoader; polished JavaDoc for other concrete context loaders. --- .../AnnotationConfigContextLoader.java | 35 +++++++++++++------ .../GenericPropertiesContextLoader.java | 10 +----- .../support/GenericXmlContextLoader.java | 2 +- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java index 5503f5f739..ac9e44893b 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java @@ -21,11 +21,22 @@ import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.support.BeanDefinitionReader; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.GenericApplicationContext; +import org.springframework.test.context.ContextLoader; import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * TODO Document AnnotationConfigContextLoader. + * Concrete implementation of {@link AbstractGenericContextLoader} which + * creates an {@link AnnotationConfigApplicationContext} and registers + * bean definitions from + * {@link org.springframework.context.annotation.Configuration configuration classes}. + * + *

This ContextLoader supports class-based context configuration + * {@link #getResourceType() resources} as opposed to string-based resources. + * Consequently, locations (as discussed in the {@link ContextLoader} + * API and superclasses) are interpreted as fully qualified class names + * in the context of this class. The documentation and method parameters + * reflect this. * * @author Sam Brannen * @since 3.1 @@ -46,16 +57,18 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader /** * Registers {@link org.springframework.context.annotation.Configuration configuration classes} * in the supplied {@link AnnotationConfigApplicationContext} from the specified - * class names. Each class name must be the fully qualified class name of a - * configuration class. The AnnotationConfigApplicationContext - * assumes the responsibility of loading the appropriate bean definitions. + * class names. + *

Each class name must be the fully qualified class name of an + * annotated configuration class, component, or feature specification. The + * AnnotationConfigApplicationContext assumes the responsibility + * of loading the appropriate bean definitions. *

Note that this method does not call {@link #createBeanDefinitionReader}. * @param context the context in which the configuration classes should be registered * @param classNames the names of configuration classes to register in the context * @throws IllegalArgumentException if the supplied context is not an instance of * AnnotationConfigApplicationContext or if a supplied class name * does not represent a class - * @see #createGenericApplicationContext + * @see #createGenericApplicationContext() */ @Override protected void loadBeanDefinitions(GenericApplicationContext context, String... classNames) { @@ -111,16 +124,18 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader } /** - * Returns the supplied locations unmodified. + * Returns the supplied class names unmodified. */ @Override - protected String[] modifyLocations(Class clazz, String... locations) { - return locations; + protected String[] modifyLocations(Class clazz, String... classNames) { + return classNames; } /** * Returns "Config"; intended to be used as a suffix - * to be appended to the name of the test class. + * to append to the name of the test class when generating default + * configuration class names. + * @see #generateDefaultLocations(Class) */ @Override protected String getResourceSuffix() { @@ -131,7 +146,7 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader * Returns {@link ResourceType#CLASSES}. */ @Override - public ResourceType getResourceType() { + public final ResourceType getResourceType() { return ResourceType.CLASSES; } diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericPropertiesContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericPropertiesContextLoader.java index 9d49ee3327..67b0ec8561 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericPropertiesContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericPropertiesContextLoader.java @@ -23,10 +23,8 @@ import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader; import org.springframework.context.support.GenericApplicationContext; /** - *

* Concrete implementation of {@link AbstractGenericContextLoader} which reads * bean definitions from Java {@link Properties} resources. - *

* * @author Sam Brannen * @since 2.5 @@ -34,12 +32,8 @@ import org.springframework.context.support.GenericApplicationContext; public class GenericPropertiesContextLoader extends AbstractGenericContextLoader { /** - *

* Creates a new {@link PropertiesBeanDefinitionReader}. - *

- * - * @return a new PropertiesBeanDefinitionReader. - * @see AbstractGenericContextLoader#createBeanDefinitionReader(GenericApplicationContext) + * @return a new PropertiesBeanDefinitionReader * @see PropertiesBeanDefinitionReader */ @Override @@ -49,8 +43,6 @@ public class GenericPropertiesContextLoader extends AbstractGenericContextLoader /** * Returns "-context.properties". - * - * @see org.springframework.test.context.support.AbstractContextLoader#getResourceSuffix() */ @Override public String getResourceSuffix() { diff --git a/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericXmlContextLoader.java b/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericXmlContextLoader.java index 8532295158..a850abc254 100644 --- a/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericXmlContextLoader.java +++ b/org.springframework.test/src/main/java/org/springframework/test/context/support/GenericXmlContextLoader.java @@ -31,7 +31,7 @@ public class GenericXmlContextLoader extends AbstractGenericContextLoader { /** * Create a new {@link XmlBeanDefinitionReader}. - * @return a new XmlBeanDefinitionReader. + * @return a new XmlBeanDefinitionReader * @see XmlBeanDefinitionReader */ @Override