AnnotationConfigContextLoaderUtils (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.test.context.support

## Class AnnotationConfigContextLoaderUtils

- java.lang.Object
- - org.springframework.test.context.support.AnnotationConfigContextLoaderUtils

-     public abstract class AnnotationConfigContextLoaderUtils
      extends Object

  Utility methods for `SmartContextLoaders` that deal with annotated classes (e.g., `@Configuration` classes).
  Since:
    3.2
  Author:
    Sam Brannen

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Class<?>[]` | `detectDefaultConfigurationClasses(Class<?> declaringClass)` Detect the default configuration classes for the supplied test class.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### detectDefaultConfigurationClasses

          public static Class<?>[] detectDefaultConfigurationClasses(Class<?> declaringClass)

      Detect the default configuration classes for the supplied test class.

      The returned class array will contain all static inner classes of the supplied class that meet the requirements for `@Configuration` class implementations as specified in the documentation for `@Configuration`.

      The implementation of this method adheres to the contract defined in the `SmartContextLoader` SPI. Specifically, this method uses introspection to detect default configuration classes that comply with the constraints required of `@Configuration` class implementations. If a potential candidate configuration class does not meet these requirements, this method will log a warning, and the potential candidate class will be ignored.

      Parameters:
        `declaringClass` - the test class that declared `@ContextConfiguration`
      Returns:
        an array of default configuration classes, potentially empty but never `null`