【问题标题】:How can I remove hibernate in grails 3.x?如何在 grails 3.x 中删除休眠?
【发布时间】:2017-04-12 00:16:12
【问题描述】:

这个 SO question 推荐的命令对于 grails 3.1.x 不存在 Can I configure Grails with no datasource?

grails uninstall-plugin hibernate
| Error Command not found uninstall-plugin

有问题的 grails 应用程序不需要持久性,我正在尝试减少内存占用。 寻找适用于 grails 3.1.x 或更高版本的答案。

【问题讨论】:

    标签: hibernate grails grails-orm grails-3.1


    【解决方案1】:

    要删除所有休眠,您需要做的就是从 build.gradle 删除您不想要/不需要的任何休眠依赖项。

    例如:删除这些(从 3.2.8 开始)

    构建脚本:

    classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
    

    依赖:

    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:$hibernateVersion"
    compile "org.hibernate:hibernate-ehcache:$hibernateVersion"
    

    您也可以使用 CLI grails create-app --features ... 并且不包含休眠功能,只包含您想要的功能。

    【讨论】:

      【解决方案2】:

      从您的 application.yml 中删除依赖项。

      顺便说一句,如果您不需要持久性,您是否考虑过使用Spark Java 而不是 Grails?它超级轻巧,您可以轻松地使用 Groovy。

      【讨论】:

        猜你喜欢
        • 2011-12-01
        • 2011-05-19
        • 1970-01-01
        • 2012-02-16
        • 1970-01-01
        • 1970-01-01
        • 2016-11-27
        • 2023-03-13
        • 2022-06-15
        相关资源
        最近更新 更多