Annotation Interface StaticValue


@Target(FIELD) @Retention(RUNTIME) public @interface StaticValue
Similar to Spring's Value-annotation, this annotation can be applied to static fields. This annotation supports SpEL (Spring Expression Language) and/or Spring property placeholders.

Example


 public class Example {

   // Using Spring property placeholder
   @StaticValue("${my.custom.property}")
   private static String exampleWithoutDefault;

   // Spring property placeholder with default value, defaults to "someDefault"
   @StaticValue("${my.custom.other-property:someDefault}")
   private static String exampleWithSomeDefault;
 }
 

Note that actual processing of the StaticValue annotation is performed by StaticValueInjector.

Since:
0.1.0
Author:
Chrimle
See Also:
  • Value
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The value expression, such as #{systemProperties.myProp}, or property placeholder such as ${my.app.myProp}.
  • Element Details

    • value

      String value
      The value expression, such as #{systemProperties.myProp}, or property placeholder such as ${my.app.myProp}.
      Returns:
      the value of this annotation.
      Since:
      0.1.0