title: Grails - using property value for cron expression in scheduled job
body: <p>Am using the Quartz plugin for Grails and have a simple job:</p>
  
  <pre><code>class MyJob{
  
     static triggers = {
         cron name: 'MyJobTrigger', cronExpression: '0 0/1 * * * ?'
     }
     def execute(){
         println "do some work"
     }
  }
  </code></pre>
  
  <p>All works fine, job fires off every minute as expected.</p>
  
  <p>Now I want the want the cron expression to be property driven so I can override in different environments. So Config.groovy contains the default value:</p>
  
  <pre><code>myJob.cron = '0 0/1 * * * * ?'
  </code></pre>
  
  <p>And I change my class to have:</p>
  
  <pre><code>   GrailsApplication grailsApplication
  
     static triggers = {
         cron name: 'MyJobTrigger', cronExpression: grailsApplication.config.myJob.cron
     }
  </code></pre>
  
  <p>When I run my code, I get this error:</p>
  
  <pre><code>Caused by MissingPropertyException: No such property: grailsApplication for class: MyJob
  </code></pre>
  
  <p>Assuming this is something to do with the way the MyJob class is loaded/initialised, the static triggers created before the GrailsApplication is injected??? This use of GrailsApplication is the usual way I get project properties.</p>
  
  <p>How else can I have a property driven cron trigger?</p>