Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-RC
-
Fix Version/s: 1.0-RC
-
Labels:None
Description
Currently you cannot override quartz config with an external file (as you can with normal grails config), if, for example, you wanted to run quartz on one server and not another.
This is due to the way the config is merged. In QuartzGrailsPlugin, the application config is loaded first and then has the DefaultQuartzConfig merged into it and then your own QuartzConfig merged (if it exists):
QuartzGrailsPlugin.groovy
private ConfigObject loadQuartzConfig() { def config = ConfigurationHolder.config def classLoader = new GroovyClassLoader(getClass().classLoader) // merging default Quartz config into main application config config.merge(new ConfigSlurper(GrailsUtil.environment).parse(classLoader.loadClass('DefaultQuartzConfig'))) // merging user-defined Quartz config into main application config if provided try { config.merge(new ConfigSlurper(GrailsUtil.environment).parse(classLoader.loadClass('QuartzConfig'))) } catch (Exception ignored) { // ignore, just use the defaults } ... }
If this was reversed (i.e the application config was merged last) then this problem would be fixed.
There is a workaround, but it's fairly nasty - define your own DefaultQuartzConfig in your grails-app/config folder to look like this:
quartz { autoStartup = org.codehaus.groovy.grails.commons.ConfigurationHolder.config.quartz.autoStartup jdbcStore = false waitForJobsToCompleteOnShutdown = true } environments { test { quartz { autoStartup = false } } }