[SPR-6184] completed JavaDoc for AnnotationConfigContextLoader; polished JavaDoc for other concrete context loaders.

master
Sam Brannen 14 years ago
parent 174bf58308
commit a16f3ba9dc
  1. 35
      org.springframework.test/src/main/java/org/springframework/test/context/support/AnnotationConfigContextLoader.java
  2. 10
      org.springframework.test/src/main/java/org/springframework/test/context/support/GenericPropertiesContextLoader.java
  3. 2
      org.springframework.test/src/main/java/org/springframework/test/context/support/GenericXmlContextLoader.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}.
*
* <p>This <code>ContextLoader</code> supports class-based context configuration
* {@link #getResourceType() resources} as opposed to string-based resources.
* Consequently, <em>locations</em> (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 <code>AnnotationConfigApplicationContext</code>
* assumes the responsibility of loading the appropriate bean definitions.
* class names.
* <p>Each class name must be the <em>fully qualified class name</em> of an
* annotated configuration class, component, or feature specification. The
* <code>AnnotationConfigApplicationContext</code> assumes the responsibility
* of loading the appropriate bean definitions.
* <p>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
* <code>AnnotationConfigApplicationContext</code> 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 <code>locations</code> 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 &quot;Config</code>&quot;; 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;
}

@ -23,10 +23,8 @@ import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;
/**
* <p>
* Concrete implementation of {@link AbstractGenericContextLoader} which reads
* bean definitions from Java {@link Properties} resources.
* </p>
*
* @author Sam Brannen
* @since 2.5
@ -34,12 +32,8 @@ import org.springframework.context.support.GenericApplicationContext;
public class GenericPropertiesContextLoader extends AbstractGenericContextLoader {
/**
* <p>
* Creates a new {@link PropertiesBeanDefinitionReader}.
* </p>
*
* @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 &quot;<code>-context.properties</code>&quot;.
*
* @see org.springframework.test.context.support.AbstractContextLoader#getResourceSuffix()
*/
@Override
public String getResourceSuffix() {

@ -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

Loading…
Cancel
Save