Reputation: 341
grailsApplication.config.myJob.cron.cronExpression = Configuration.findByConfigKey("schedule")?.configValue
MyJob.schedule(grailsApplication.config.archiveTablesJob.cron.cronExpression)
Bootstrap error...java.lang.RuntimeException.
Its not getting the value from config
How to get the cron value from a table(database) dynamically?
Upvotes: 0
Views: 368
Reputation: 1983
In your Bootstrap.groovy file set up like this.
import com.Myjob //import your job package
class BootStrap {
def grailsApplication
def init = { servletContext ->
grailsApplication.config.myJob.cron.cronExpression = Configuration.findByConfigKey("schedule")?.configValue
MyJob.schedule(grailsApplication.config.myJob.cron.cronExpression)
}
}
Upvotes: 1