Annotation Type Value


@Retention(CLASS) @Target({FIELD,PARAMETER,METHOD}) public @interface Value

Injects a configuration value.

${key} reads key from Config -- a system property, the environment, the profile's properties file or the base one, in that order -- and ${key:fallback} supplies a value when none of them has it. The text around a reference is kept, so "${host}:${port}" works. A String, a primitive or its box, or an enum can receive one; the conversion is written into the generated entry point.

A key nobody sets, with no fallback, is a start-up error naming the key: a missing setting is the deployment's mistake, and start-up is where it is cheap to see.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The expression, such as ${mail.host:localhost}.
  • Element Details

    • value

      String value
      The expression, such as ${mail.host:localhost}.