title: Dynamic configuration for @Scheduled in Spring Boot
body: <p>I'm trying to dynamically configure a Spring Boot schedule using the configuration file.</p>
  
  <p>The goal is to have the following in my <code>application.yml</code>:
  </p>
  
  <pre><code>platform:
    plata:
      schedule:
        cron: '0 0 9 * * *'
    platb:
      schedule:
        initialDelay = 20000
        fixedDelay = 10000000
  </code></pre>
  
  <p>What I'm struggling with, is how I can now apply this configuration to the <code>@Scheduled</code> annotations. I was thinking something like the following:</p>
  
  <p><code>Scheduler.java:</code>
  </p>
  
  <pre><code>@Scheduled("${platform.plata.schedule}")
  public void plata() throws CalculationException {
      ...
  }
  
  @Scheduled("${platform.platb.schedule}")
  public void platb() throws CalculationException {
      ...
  }
  </code></pre>