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

org.springframework.test.context

## Annotation Type ActiveProfiles

-     @Documented
      @Inherited
      @Retention(value=RUNTIME)
      @Target(value=TYPE)
      public @interface ActiveProfiles

  `ActiveProfiles` is a class-level annotation that is used to declare which active bean definition profiles should be used when loading an `ApplicationContext` for test classes.
  Since:
    3.1
  Author:
    Sam Brannen
  See Also:
    `SmartContextLoader`, `MergedContextConfiguration`, `ContextConfiguration`, `ApplicationContext`, `Profile`

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `boolean` | `inheritProfiles` Whether or not bean definition profiles from superclasses should be inherited.
    `String[]` | `profiles` The bean definition profiles to activate.
    `String[]` | `value` Alias for `profiles()`.

- - ### Element Detail

    - #### value

          public abstract String[] value

      Alias for `profiles()`.

      This attribute may not be used in conjunction with `profiles()`, but it may be used instead of `profiles()`.

      Default:
        {}

    - #### profiles

          public abstract String[] profiles

      The bean definition profiles to activate.

      This attribute may not be used in conjunction with `value()`, but it may be used instead of `value()`.

      Default:
        {}

    - #### inheritProfiles

          public abstract boolean inheritProfiles

      Whether or not bean definition profiles from superclasses should be inherited.

      The default value is `true`, which means that a test class will inherit bean definition profiles defined by a test superclass. Specifically, the bean definition profiles for a test class will be appended to the list of bean definition profiles defined by a test superclass. Thus, subclasses have the option of extending the list of bean definition profiles.

      If `inheritProfiles` is set to `false`, the bean definition profiles for the test class will shadow and effectively replace any bean definition profiles defined by a superclass.

      In the following example, the `ApplicationContext` for `BaseTest` will be loaded using only the "base" bean definition profile; beans defined in the "extended" profile will therefore not be loaded. In contrast, the `ApplicationContext` for `ExtendedTest` will be loaded using the "base" and "extended" bean definition profiles.

           @ActiveProfiles("base")
           @ContextConfiguration
           public class BaseTest {
               // ...
           }

           @ActiveProfiles("extended")
           @ContextConfiguration
           public class ExtendedTest extends BaseTest {
               // ...
           }

      Note: `@ActiveProfiles` can be used when loading an `ApplicationContext` from path-based resource locations or annotated classes.

      See Also:
        `ContextConfiguration.locations()`, `ContextConfiguration.classes()`, `ContextConfiguration.inheritLocations()`
      Default:
        true