title: Injecting externalized value into Spring annotation
body: <p>I've been thinking around the Java feature that evaluates annotation values in compile-time and it seems to really make difficult externalizing annotation values.</p>
  
  <p>However, I am unsure whether it is actually impossible, so I'd appreciate any suggestions or definitive answers on this.</p>
  
  <p>More to the point, I am trying to externalize an annotation value which controls delays between scheduled method calls in Spring, e.g.:</p>
  
  <pre><code>public class SomeClass {
  
      private Properties props;
      private static final long delay = 0;
  
      @PostConstruct
      public void initializeBean() {
          Resource resource = new ClassPathResource("scheduling.properties");
          props = PropertiesLoaderUtils.loadProperties(resource);
          delay = props.getProperties("delayValue");
      }
  
      @Scheduled(fixedDelay = delay)
      public void someMethod(){
          // perform something
      }
  }
  </code></pre>
  
  <p>Suppose that <code>scheduling.properties</code> is on classpath and contains property key <code>delayValue</code> along with its corresponding long value.</p>
  
  <p>Now, this code has obvious compilation errors since we're trying to assign a value to <code>final</code> variable, but that is mandatory, since we can't assign the variable to annotation value, unless it is <code>static final</code>.</p>
  
  <p>Is there any way of getting around this? I've been thinking about Spring's custom annotations, but the root issue remains - how to assign the externalized value to annotation?</p>
  
  <p>Any idea is welcome.</p>
  
  <p>EDIT: A small update - Quartz integration is overkill for this example. We just need a periodic execution with sub-minute resolution and that's all.</p>