如何从另一个grails插件配置grails插件 [英] How to configure a grails plugin from another grails plugin
问题描述
我正在尝试编写一个插件,可以在几个Grails应用程序中重用。
插件应该基本上是弹簧安全核心和ldap的包装插件。
这意味着它应该包含: 我的问题是我无法获得我的插件中的配置工作。我对目前为止发现的例子感到困惑:有时我读到配置应该简单地转到Config.groovy,但是 grails docs 声明这个文件最终不是插件的一部分。在一些例子中,它说你必须把配置放在任何其他的.groovy文件中,并用如下的标识符来包装: 然后加载它在MyWrapperPlugin.groovy类的 我找不到任何试图达到同样目的的例子(在另一个插件中设置插件的配置)。 赞赏任何示例/提示,谢谢! 您可以使用 Grails Platform Core 提供了插件用于实现彼此更大集成的功能,与应用程序 配置API ,这是你在找什么。只需将doWithConfig添加到插件描述符文件(* GrailsPlugin.groovy)中即可: I am trying to write a plugin which I can reuse in several grails applications.
The plugin should basically be a wrapper for the spring security core and the ldap plugin. Which means it should contain: My problem is that i can't get the configuration inside my plugin working. I am confused by the examples I found so far: sometimes I read that the configuration should simply go to "Config.groovy" however grails docs state that this file isn't part of a plugin in the end. In some examples it says that you have to put the configuration in any other .groovy file and wrap it with some identifier like so: and then load it in the I could not find any example which tries to achieve the same thing (setting the configuraiton of a plugin inside another plugin) up to now. Any examples/hints are appreciated, thanks! You can use the Grails Platform Core that provides functionality for plugins to use to achieve greater integration with each other and with applications The Configuration API it's what you are looking for. Just add the doWithConfig in your plugin descriptor file (*GrailsPlugin.groovy):
这篇关于如何从另一个grails插件配置grails插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
myConfigName {
//正常配置在这里
}
doWithSpring
闭包中通过一些slurper。但是,如果我正确理解这一点,这只会将配置放置在 grails.plugin.mywrapper
名称空间中。
$ b
def doWithConfig = {config - >
application {
grails.plugins.springsecurity.ldap.active = true
...
}
}
myConfigName {
// normal config here
}
doWithSpring
closure in the MyWrapperPlugin.groovy class via some slurper. However if i understand this correctly, this will only put the configuration in a grails.plugin.mywrapper
namespace.
def doWithConfig = { config ->
application {
grails.plugins.springsecurity.ldap.active=true
...
}
}