在 grails 中外部化quartz配置
我正在尝试外部化 QuartzConfig.groovy
我希望能够使用外部文件将 autoStartup 设置为 true 或 false 。
在 Config.groovy 中,可以使用 grails.config.locations 并设置覆盖属性的属性文件。 QuartzConfig.groovy 中有类似的东西吗?
谢谢
I'm trying to externalize the QuartzConfig.groovy
I want to be able to set autoStartup to true or false with an external file.
In Config.groovy it is possible to use the grails.config.locations and set properties file that override the properties. Is there something like this in QuartzConfig.groovy ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不,你不能。请参阅此 jira 了解更多信息。
No, you can't. See this jira for more information.
基于常规配置变量在 Bootstrap 中启动 Quartz 对我来说效果最好。
QuartzConfig.groovy:
BootStrap.groovy:
感谢伯特。 http://grails.1312388.n4 .nabble.com/Reduce-Quartz-Plugin-Start-up-Time-td1371547.html
Starting Quartz in Bootstrap based on a regular config variable worked best for me.
QuartzConfig.groovy:
BootStrap.groovy:
Thanks to Burt. http://grails.1312388.n4.nabble.com/Reduce-Quartz-Plugin-Start-up-Time-td1371547.html
QuartzConfig.groovy 仍然没有内置的外部化配置机制。
我们在 10 年也有同样的问题。我们的解决方案是分叉插件并使用内置配置及其外部化配置
快进到现在(2011 年 3 月),看起来quartz 插件已经实现了一些新功能。
https://github.com/grails-plugins/grails-quartz /blob/master/QuartzGrailsPlugin.groovy
(查看文件末尾的
loadQuartzConfig()
部分)看起来该功能可以通过默认的 Config.groovy config.locations 机制进行扩展。
这就是它正在做的事情:
Config.groovy
)DefaultQuartzConfig
中,并合并到QuartzConfig
中。 > 从 classLoaderquartz.properties
如果需要,您现在可以在 Config.groovy 中设置您的配置。
QuartzConfig.groovy still doesn't have an externalized configuration mechanism built-in.
We had the same question back in '10. Our solution was to fork the plugin and use the built-in configuration with it's externalized config
Fast forward to now (March '11) and It looks like the quartz plugin has implemented some new features.
https://github.com/grails-plugins/grails-quartz/blob/master/QuartzGrailsPlugin.groovy
(checkout the
loadQuartzConfig()
section at the end of the file)It looks like the functionality is extensible via the default Config.groovy config.locations mechanism.
This is what it appears to be doing:
Config.groovy
)DefaultQuartzConfig
on from the classLoaderQuartzConfig
from the classLoaderquartz.properties
from the classLoaderYou can setup your configuration in Config.groovy now if you want.
您可能需要查看 http://www.grails.org/doc/1.0.x/guide/3.%20Configuration.html。
虽然我还没有尝试外部化石英,但我已经使用它来外部化日志记录:
并且它工作得很好。
You may want to look 3.4 Externalized Configuration of http://www.grails.org/doc/1.0.x/guide/3.%20Configuration.html.
Though I haven't try externalize for quartz, I have use this to externalize logging:
And it works perfectly.