Annotation Type Profile


@Retention(CLASS) @Target({TYPE,METHOD}) public @interface Profile

Constructs this bean only when a profile is active.

@Profile("dev") is active under CN1_PROFILE=dev; @Profile("!prod") is active under every profile but prod; several values mean any of them. The profile is the deployment's to choose, so this is the one decision the build cannot make: it becomes a single if in the generated start-up code. The build still checks that every bean needing this one is covered either way -- by another bean of the same type under the other profiles, or by being conditional itself.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The profiles, each optionally negated with !.
  • Element Details

    • value

      String[] value
      The profiles, each optionally negated with !.