模块化应用程序中的 Spring Security 插件

发布于 2024-12-07 10:07:29 字数 551 浏览 0 评论 0原文

我正在启动一个新的模块化 Grails 应用程序。我正在创建一个域插件,当然需要一个用户/个人域。

我是否将 Spring Security Core 插件添加到域中,只是为了生成其用户域?如果是这样,我是否也将插件添加到主应用程序中。或者由于主应用程序将使用域插件,它会继承Spring Security插件吗?

无论哪种情况,与只有 1 个包含域对象的应用程序相比,我是否需要了解或采取不同的做法?

更新

我将其添加到我的主应用程序的构建配置中:

 plugins {
        . . .
        compile ":spring-security-core:1.2.1"
        . . .
    }   

grails.plugin.location.astdomain ="C:\\src\\astool\\astdomain"

在主应用程序中生成所有内容不起作用。找不到我指定的域。因此,我在域插件中生成了所有内容,然后将生成的代码移至主应用程序中。即使生成的代码与域具有相同的包,我仍然收到编译错误,指出找不到域。

I'm starting a new, modular Grails application. I'm creating a domain plugin and of course need a User/Person domain.

Do I add the Spring Security Core plugin to domain, just to generate the its user domain? If so, do I also add the plugin to the main app. Or since the main app will use the domain plugin, will it inherit the Spring Security plugin?

In either case, is there anything I need to know or do differently than if I just had 1 application with the domain objects?

UPDATE

I added this to the buildconfig of my main app:

 plugins {
        . . .
        compile ":spring-security-core:1.2.1"
        . . .
    }   

grails.plugin.location.astdomain ="C:\\src\\astool\\astdomain"

Doing generate all in the main app didn't work. The domain I specified was not found. So I did a generate all in the domain plugin then moved the generated code into the main app. And even though the generated code has the same package as the domains, I still get a compile error saying the domain isn't found.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神经大条 2024-12-14 10:07:29

查看插件部分。然而,我相信分发过程已经发生了变化,因为 发布插件 似乎正在成为主流/ Grails 2.0 的事实上的标准。

这完全取决于您如何设置。您应该能够将 spring security 插件添加到您的插件中(这本质上就是您在构建模块化应用程序、将更大的应用程序构建为一系列插件时所做的事情)并指定插件依赖项、构建顺序等。

通过正确的设置,您应该能够编写独立的插件,在引用您的插件的主应用程序上运行 grails install-plugin,然后使用包解析来访问主应用程序的其他类中的插件域类。

Check out the section on plugins. I believe the distribution process has changed, however, as the Release plugin seems to be becoming mainstream/the de-facto standard as of Grails 2.0.

It all depends on how you set it up. You should be able to add the spring security plugin to your plugin (which is essentially what you are doing in building a modular app, building a larger one as a series of plugins) and specify plugin dependencies, build orders, and the such that way.

With the right setup, you should be able to write your self-contained plugin, run a grails install-plugin on the main app referencing your plugin, and then use package resolution to get access to your plugin's domain classes in the main app's other classes.

世俗缘 2024-12-14 10:07:29

事实证明,唯一的问题是我将插件放在了错误的位置。

我有

grails.project.dependency.resolution = {

  . . .

 plugins {
        . . .
        compile ":spring-security-core:1.2.1"
        . . .
    }   

  grails.plugin.location.astdomain ="C:\\src\\astool\\astdomain"


}

但它需要包含在 grails.project.dependency.resolution = { 之外。 。 }:

grails.plugin.location.'astdomain' ="../astdomain"
grails.project.dependency.resolution = { . . }

还要注意,我现在在“astdomain”周围有引号。我不确定这是否重要,但我看到其他人是如何这样做的。

我还使用更通用的语法:“../astdomin”。但“C:...”也有效。

It turned out that the only problem was that I was including the plugin in the wrong place.

I had

grails.project.dependency.resolution = {

  . . .

 plugins {
        . . .
        compile ":spring-security-core:1.2.1"
        . . .
    }   

  grails.plugin.location.astdomain ="C:\\src\\astool\\astdomain"


}

But it needs to be included outside grails.project.dependency.resolution = { . . }:

grails.plugin.location.'astdomain' ="../astdomain"
grails.project.dependency.resolution = { . . }

Notice too that I now have quotes around 'astdomain'. I'm not sure if that matters or not, but that how I saw someone else do this.

I'm also using the more general syntax: "../astdomin". But "C:..." does work too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文