title: Spring: Injecting property as a value into an annotation
body: <p>I am trying to inject a value into a Custom Annotation but Spring doesn't seem to be evaluating.</p>
  
  <p>Here is my annotation:</p>
  
  <pre><code>@Target(ElementType.METHOD)
  @Retention(RetentionPolicy.RUNTIME)
  public @interface MyCustomAnno {
      String var1();
      String var2();
  }
  </code></pre>
  
  <p>Here is my Bean (it is created in a Spring Configuration file) with Annotation:</p>
  
  <pre><code>public class MyClass {
  
      @MyCustomAnno(var1 = "${some.property.one}",
                    var2 = "${some.property.two}")
      public void someMethod() {
      // do something here
      }
  }
  </code></pre>
  
  <p>Here is the Aspect where I am trying to use the values passed into the annotation:</p>
  
  <pre><code>@Aspect
  public class MyAop {
  
      @Around(value="@annotation(myCustomAnno)",argNames="myCustomAnno")
      public Object aroundMethod(MyCustomAnno myCustomAnno) {
          int intVar1 = Integer.parseInt(myCustomAnno.var1());
          int intVar2 = Integer.parseInt(myCustomAnno.var2());
  
          // ....
      }
  }
  </code></pre>
  
  <p>In the around method I am receiving a NumberFormatException: For input string: ${some.property.one}. This means that Spring didn't inject the value for some reason.</p>
  
  <p>In case you are wondering, in the same class I can do the normal @Value annotation and the value gets injected properly:</p>
  
  <pre><code>@Value("${some.property.one}")
  private propertyOne;            // This works
  </code></pre>
  
  <p>Is it possible to do what I want to and if so, how?</p>