web-applications - Grails 是否适合复杂的应用程序?

标签 web-applications grails groovy

我们的组织正计划使用 Grails 来实现一个复杂的
带有 REST 接口(interface)的应用程序。我担心可扩展性
框架,鉴于:

  • 领域类肯定会大量使用多态性。我听说人们在 Grails 中遇到继承问题,例如 because of this problem on JIRA .
  • 对象树将保存在数据库中。在 GORM 中,这将是
    就像是:
    class Node
    {
      static def hasMany = [children: Node]
    }
    

    我认为我们可以从级联操作中受益来管理依赖项,但我不确定在这种情况下它会如何工作。
  • 数据库应该增长到存储数百万个对象
    并且应该与 Oracle、SQL Server 和 PostgreSQL 一起工作。指望 Grails DB 映射免费提供这种兼容性有多现实?
  • 我们计划利用自定义域约束来检查
    域对象的一致性。但我感觉你在验证器中可以做的事情是有限的(我不确定你是否可以,例如,加载一组其他对象)
  • 服务中实现的业务逻辑将是多线程的

  • 书籍和网络上的大多数示例都非常简单
    对独立对象集进行 CRUD 操作的应用程序。

    恐怕我最终会使用一个非常小的功能子集
    应用程序增长时的 Grails,如脚手架、Web 流、ajax 或
    甚至域类生成的 DB 模式也可能不对应
    完全符合我的应用程序的需要。

    有没有人分享使用 Grails 进行这样的
    应用?

    最佳答案

    domain classes will for sure make heavy use of polymorphism. I heard people have trouble with inheritance in Grails, for instance because of this problem on JIRA.



    Grails 2.0 中的继承得到了改进。请参阅有关 Abstract Inheritance 的部分.报告的 JIRA 错误中提到的问题可以通过将属性声明为 transient 来解决。

    Trees of objects will be saved in the database. In GORM this would be something like:



    自我参照关系很好。有关详细信息,请参阅 Grails in Action 第 3 章。

    the database is supposed to grow to store millions of objects and should work with Oracle, SQL Server and PostgreSQL. How realistic is it to count on Grails DB mapping to have this compatibility for free?



    Grails 建立在 Hibernate 之上,这是一个用于各种大型 J2EE 应用程序的企业级 ORM 层。根据您正在运行的查询类型,您可能需要使用标准并在该级别进行调整,但 Grails 没有提供阻止其扩展的固有限制。

    we plan to leverage the custom domain constraint mechanism to check the consistency of domain objects. But I have the feeling what you can do in a validator is limited (I am not sure if you can, for instance, load a set of other objects)



    您可以使用 this 进行跨领域验证.您也可以定义自己的custom validator classes .

    business logic implemented in services will be multi-threaded



    It is recommended not to store state in services ,但您可以在多线程操作中使用它们,因为有不同的 scopes可用的。当然,您有责任控制并发访问。

    Our organization is planning to use Grails to realize a complex application with a REST interface.



    使用 Grails 的 REST 接口(interface)相当有趣且简单。见 Grails in Action Beginning Groovy and Grails from Novice to Professional 的第 11 章或第 9/13 章.

    Grails 建立在久经考验的 J2EE 技术之上,例如 SpringHibernate .虽然“开箱即用”可能只带您到此为止,但该框架可在各个级别进行配置以满足您的需求。因此,您实质上是在询问 J2EE 是否可以很好地扩展。 Many people seem to say yes .

    关于web-applications - Grails 是否适合复杂的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7869868/

    相关文章:

    grails如何覆盖g消息标签

    grails - 如何在Grails 2.0中创建和检索Cookies?

    multithreading - 使用Spock测试线程并发

    grails - 有什么方法可以覆盖默认的 Camel FatalFallbackErrorHandler 吗?

    java - Struts2 + Sitemesh + Freemarker 不起作用

    java - Google OAuth2 PlayGround 返回 "Unauthorized Client"

    html - 在Grails测试报告的系统输出中打印html标签

    Jenkins 发布者 postBuildScripts 不起作用

    javascript - 使用 JavaScript 和 Node.js 创建多语言网站

    java - 在eclipse java ee中连接MySQL