CRUD:去 Roo 还是不去 Roo?

发布于 2024-10-03 17:00:49 字数 167 浏览 6 评论 0原文

我一直在使用 Groovy on Rails 进行 CRUD 应用程序。我正在开始一个新项目,我们不再允许使用 Grails(我们有一个允许的 jars 和 grails 的列表) 不在那里)。

我正在考虑使用 Spring ROO 或 JBoss Seam。他们如何比较?他们的主要优点和缺点是什么?

I have been using Groovy on Rails for CRUD applications. I am starting a new project where we are not allowed to use Grails anymore (we have a list of allowed jars and grails
is not there).

I am considering using Spring ROO or JBoss Seam. How do they compare? What are their major strengths and weaknesses?

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

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

发布评论

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

评论(3

得不到的就毁灭 2024-10-10 17:00:49

请注意,Spring Roo 和 JBoss Seam 不能直接比较,因为 JBoss Seam 本身不提供问题中提到的 CRUD 应用程序生成。然而,JBoss Seam 附带了 seam-gen 工具,它提供了此功能。因此,最好将 JBoss Seam 与 Spring 框架进行比较,并将 seam-gen 工具与 Spring Roo 进行比较。我知道这也不是完整的比较,但我想这超出了本主题的范围。需要说明的是,在下面的回答中,当我提到 JBoss Seam 时,我实际上指的是 JBoss Seam 与 seam-gen 工具的结合。

Spring Roo 和 JBoss Seam(带有 seam-gen) )使 CRUD 应用程序的创建变得非常容易,就像其他 Java 全栈/脚手架解决方案一样,例如 Play FrameworkRIFE 也是如此。如果您比较两者(Spring ROO 和 JBoss Seam 以及 seam-gen)基于现有数据库或通过添加实体并定义字段和关系来启动和运行新的基本 CRUD 应用程序的速度,我想有没有那么大的区别。根据我的经验,您可以在 Spring Roo 中更快(稍微)一点,但是使用这两种方法,您可以在不到一个小时(如果是现有数据库)或不到(半)天(在如果您必须手动添加所有实体和关系)。

在继续之前,读者应该注意,整个比较是根据我对这两种解决方案的浅薄经验进行的,因此基于 Spring Roo 版本 1.1.0 和 JBoss Seam 1.2 和 2.x。读者还应该注意到,目前已经有一个基于 Java EE 6 规范的优秀 Seam 3 版本(实际上是带有 Seam 模块插件的 CDI(Weld)),但是这个新版本的 JBoss Seam 不再具有 Seam- gen 应用程序,因此尚不具备仅使用几个命令(如 Spring Roo 和 JBoss Seam 2.x 及更低版本)创建完整 CRUD 应用程序的功能。目前,JBoss 的一些人正在研究类似的东西,名为 JBoss Forge,它看起来非常有前途,但截至今天,还没有 Spring ROO 和 JBoss Seam(带有 seam-gen)都创建了一个不错的基本 CRUD 应用程序,

尽管 Spring Roo 生成的应用程序的默认 UI 设计看起来像以我的拙见,更好一点,但无论如何你可能都想重新设计它,所以这对任何一个都没有太大的争论。创建的 Web 应用程序在提供的功能上也略有不同,但就基本 CRUD 功能以及身份验证和国际化等其他基本功能而言,它们是相同的。

我认为主要的区别以及因此决定您想要选择哪个的原因不在于生成基本 CRUD 应用程序所需的时间,也不在于搭建的基本 CRUD 应用程序,而在于更重要的事情,例如架构/设计决策、使用、支持、文档、灵活性、可维护性、扩展点等。就我而言,Spring Roo 和 JBoss Seam 都是构建 Web 应用程序的绝佳选择(事实上,我的团队已经创建了生产应用程序与两者),但在做出决定之前,您必须查看这些重要差异并决定什么最适合您。当然,最好的决定方法是使用这两种选择为自己进行概念验证,但如果您没有时间和/或资源,这就是我可以想到的(从顶部开始)这是两者之间的差异,可能会帮助您决定采用哪种方式:

  • Spring Roo 中使用的底层构建系统是 Maven,而 JBoss Seam 使用 Ant。据我所知,Seam 也可以与 maven 一起使用,但 seam-gen 默认使用 Apache Ant。请注意,JBoss Forge(seam-gen 的替代品,实际上更像 Spring Roo)正在使用 Maven。
  • Spring Roo 基于 Spring 框架,而 JBoss Seam 基于整个 Java EE 5 堆栈(Seam 3 将使用 Java EE 6 堆栈)。请注意,JBoss Seam 和 seam-gen 工具默认使用 EJB 3.0,但这是可选的,您也可以选择使用 JBoss Seam 和 seam-gen 工具的非 EJB 解决方案。
  • JBoss Seam(带有 seam-gen)使用基本的 OO 继承,通过扩展 JBoss Seam 特定类来向生成的类添加基本功能。这确实添加了对 JBoss Seam(和 seam-gen)特定类的运行时依赖。 Spring Roo 选择了一种完全不同的方法,通过生成纯 Java 源文件(不扩展 Spring 相关类)并注释这些类。除了生成的 Java 源文件之外,Spring Roo 还生成一到多个所谓的类型间声明 (ITD) 文件,这些文件是包含生成的源代码和注释的 AspectJ 特定文件。这些 ITD 文件将在编译时完全透明地编织到生成的类文件中,因此不会强加运行时依赖性。
  • Seam生成的文件可以(并且将会)由您更新,但是如果您需要使用seam-gen重新生成文件,它将覆盖您的手动更改,这是因为您将在Seam-gen生成的文件中进行更改。由于 Spring Roo 使用 ITD 的方法,您可以在 Java 源文件中进行更改,从而覆盖 ITD 文件中生成的源代码。这使得 Spring Roo 可以重新生成 ITD,因为它保留了 Java 源文件中的手动更改,然后保持不变。
  • seam-gen 的使用更倾向于一次性生成/使用来初始设置项目并开始运行,而 Spring Roo 则在项目的整个生命周期中使用。
  • Spring Roo 可以从项目中删除,留下一个完全工作的项目,不再依赖于 Spring Roo,当然仍然可以以任何您想要的方式构建和扩展。 seam-gen 实用程序不提供这样的功能,尽管在使用 seam-gen 的情况下,您当然永远不会依赖于 seam-gen 本身,而是依赖于特定的 JBoss Seam 包(称为框架)。
  • JBoss Seam(带有seam-gen)主要针对使用JSF作为Web框架,而Spring Roo则专注于Spring MVC和/或GWT作为其Web框架。 JBoss Seam 本身对 Wickete 也有很好的支持,但不支持 seam-gen 工具。 Spring Roo 也有一个 Flex 插件,并且社区中创建了更多其他 Web 框架的插件,但它们仍然不如 Spring MVC 和 GWT 的插件。
  • JBoss Seam 和 Spring 的文档都很棒,但对于 Spring Roo 和 seam-gen 工具,它们缺乏更高级的文档。顺便说一句,Spring Roo 还在命令行 shell 中提供了非常有用的提示。
  • IDE 对 JBoss Seam 方法的支持比对 Spring Roo 方法的支持更好。这两种解决方案都有基于 Eclipse 的特定 IDE 和插件(用于 Spring Roo 的 SpringSource Tool Suite 和用于 JBoss Seam 的 JBoss IDE),并且所有其他大型 IDE(Netbeans en IntelliJ)都对基本框架有很好的支持,但非 Eclipse IDE(虽然不完全确定 IntelliJ IDE)对 Spring Roo 生成的 ITD 没有良好的支持。这不是构建中的问题,但确实在这些 IDE 中提供了智能感知和代码完成相关功能的问题。

尽管这两个出色的产品之间当然存在更多差异,而且我什至还没有触及可测试性、学习曲线和这些项目的未来等重要内容,但我希望上述要点可能已经对正在考虑这两种解决方案的人们有所帮助,做出至少更有根据的决定。我想再次强调,做出决定的最佳方法仍然是使用这两种方法创建概念验证,然后看看哪一种最适合您。

以我的拙见,可能会让您轻松快速做出决定的要点是 Spring 堆栈或 Java EE 堆栈之间的选择、IDE 支持、Web 框架和解决方案的“成熟度”。因此,如果您非常熟悉 Spring 堆栈(我猜您是这样的,因为您来自 Grails),请选择 Spring Roo,否则您可能会浪费相当多的时间来熟悉 Java EE 堆栈,包括 JSF (当然,这确实取决于您的项目的大小,但假设它不是一个非常大的项目,那么学习新技术的影响对于单个项目来说可能太大)。如果您不能或不想使用 Eclipse 并且对此非常热衷,我想 JBoss Seam 可能是一个更好的解决方案。如果您想使用 JSF 或 Wicket,请选择 JBoss Seam,而如果您想使用 Spring MVC 或 GWT,请使用 Spring Roo(对于其他 Web 框架,您选择哪个可能并不重要,尽管 Spring roo 可能会是更好的解决方案)。如果“成年”是您的主要决定点,我想您最好使用 JBoss Seam。总而言之,在两者之间做出选择可能非常困难,但至少知道这两种解决方案都非常好,并且无论哪种方式都会对您有很大帮助。

顺便说一句,请务必关注 JBoss Forge 项目,因为当前的 Seam-Gen 解决方案将在不久的将来被这个有前途的项目所取代。

Note that Spring Roo and JBoss Seam aren't directly comparable, as JBoss Seam in itself doesn't provide the CRUD application generation mentioned in the question. JBoss Seam however comes with the seam-gen tool, which provides this functionality. It would therefore probably be better to see JBoss Seam as comparable to the Spring framework and compare the seam-gen tool with Spring Roo. I know this is also not a complete comparison, but that is outside of this topice I guess. What needs to be stated is that in the below answer, when I refer to JBoss Seam, I actually am referring to JBoss Seam in combination with the seam-gen tool.

Both Spring Roo and JBoss Seam (with seam-gen) make the creation of CRUD applications really easy, as by the way other Java full stack/scaffolding solutions like the Play Framework and RIFE also do. If you compare the two (Spring ROO and JBoss Seam with seam-gen) in how fast you have a new basic CRUD application up and running, based on an existing database or by adding entities and defining the fields and relationships, I guess there isn't that much of a difference. In my experience you can do it in Spring Roo just a (slightly) bit quicker, but with both you have the application up in less than an hour (in case of an existing database) or in less than (half) a day (in case you manually have to add all entities and relationships).

Before continuing, the reader should note that this whole comparison was made based on my humble experience with both solutions, and therefore is based on Spring Roo version 1.1.0 and JBoss Seam 1.2 and 2.x. The reader should also note that there is currently already an excellent Seam 3 version (actually CDI (Weld) with Seam module addons) wich is based on the Java EE 6 spec, but that this new version of JBoss Seam no longer has the seam-gen application and therefore hasn't yet the functionality to create a complete CRUD application with just a couple of commands like Spring Roo and JBoss Seam 2.x and lower have. There are currently people from JBoss working on something similar though, named JBoss Forge, which looks very promising but which, as of today, has not yet had any actual release and is therefore not yet an option I guess.

Both Spring ROO and JBoss Seam (with seam-gen) create a nice basic CRUD application, though the default UI design of the Spring Roo generated application looks a bit better in my humble opinion, but as you probably want to restyle it anyway, this isn't much of an argument for either one. The created web applications also differ slightly in offered functionality, but for as far as the basic CRUD functionality goes and other basic features like authentication and internationalisation, they are on a par with eachother.

I think the main differences and therefore the reasons to decide for which you want to go, aren't in the time it takes to generate a basic CRUD application nor in the scaffolded basic CRUD applications, but in far more important things like architecture/design decisions, usage, support, documentation, flexibility, maintainability, extension points etc. For as far as I'm concerned, both Spring Roo and JBoss Seam are great options to base your web application on (as a matter of fact my team has created production application with both), but before you make a decision, you have to look at these important differences and decide what works best for you. Of course the best way to decide, would be to do a proof-of-concept for yourself with both options, but if you don't have the time and/or resources, here is what I can come up with (from the top of my head) that are differences between the two and that might help you decide either way:

  • The underlying build system used in Spring Roo is Maven, where JBoss Seam uses Ant. Seam can, for as far as I know, also be used with maven, but seam-gen by default uses Apache Ant. Note that JBoss Forge (replacement of seam-gen and actually more like Spring Roo) is using Maven though.
  • Spring Roo is based on the Spring framework, while JBoss Seam is based on the whole Java EE 5 stack (Seam 3 will be using the Java EE 6 stack). Note that JBoss Seam and the seam-gen tool will by default use EJB 3.0, but this is optional and you can also opt for a none-EJB solution with JBoss Seam and the seam-gen tool.
  • JBoss Seam (with seam-gen) uses basic OO inheritance to add basic functionality to generated classes by extending JBoss Seam specific classes. This does add a runtime dependency to the JBoss Seam (and seam-gen) specific classes. Spring Roo chooses a totally different approach, by generating both plain Java source files (without extending Spring related classes) and annotating these classes. Alongside the generated Java source files, Spring Roo also generates one to several so called inter-type declaration (ITD) files, which are AspectJ specific files containing generated source code and annotations. These ITD files will be completely transparently weaved into the generated class files upon compile time and therefore don't impose a runtime dependency.
  • Seam generated files can (and will) be updated by you, but if you need to regenerate the files with seam-gen, it will overwrite your manual changes, this because you will do the changes in the by Seam-gen generated files. Because of Spring Roo's approach with ITD's, you make changes in the Java source file that override the generated sourcecode in the ITD files. This makes it possible for Spring Roo to regenerate the ITD's as it leaves the manual changes, which are in the Java source file, then unchanged.
  • The usage of seam-gen is more inclined to a one-time generation/usage to initially set up the project and get a running start, whereas Spring Roo is used throughout the lifetime of the project.
  • Spring Roo can be removed from a project, leaving a completely working project that has no dependencies on Spring Roo anymore and can of course still be build and extended any way you want. The seam-gen utility doesn't offer such a functionality, though in the case of seam-gen you are of course never depending on seam-gen itself, but rather on a specific JBoss Seam package (called framework).
  • JBoss Seam (with seam-gen) is mainly targetted for using JSF as the web framework, while Spring Roo is focused on Spring MVC and/or GWT as its web framework. JBoss Seam itself has also good support for Wickete, but not with the seam-gen tool. Spring Roo also has a Flex addon and more addons for other web frameworks are created in the community, but they're all still not as good as the ones for Spring MVC and GWT.
  • Documentation is for both JBoss Seam and Spring great, but for Spring Roo and the seam-gen tool they lack the more advanced documentation. Spring Roo by the way also offers great helpful hints in the command line shell.
  • IDE support for the JBoss Seam approach is better than for the Spring Roo approach. Both the solutions have an Eclipse based specific IDE and plugins (SpringSource Tool Suite for Spring Roo and JBoss IDE for JBoss Seam) and all other big IDE's (Netbeans en IntelliJ) have great support for the base frameworks, but the none-Eclipse IDE's (not completely sure for IntelliJ IDE though) don't have good support for the by Spring Roo generated ITD's. This is not a problem in the build, but does provide problems with intellisense and code completion related functionality in these IDE's.

Though there are of course far more differences between these two great products and I haven't even touched important things like testability, learning curve and the future of these projects, I hope the above bullets might already help people who are considering these two solutions, to make an at least bit more founded decision. I like to stress again that the best way to make a decision is still to create a proof-of-concept with both these approaches and see which best suites you.

Main points, in my humble opinion, that might give you to an easy and quick decision are the choices between the Spring stack or the Java EE stack, IDE support, Web Framework and 'adulthood' of the solution. So if you are very familiar with the Spring stack (which I guess you are, seeing that you're coming from Grails), go for Spring Roo as else you might loose quite some time in getting familiar with the Java EE stack, including JSF (of course this does depend on the size of your project, but assuming it is not a very large project, the impact of learning new techniques might be too large for a single project). If you cannot or don't want to use Eclipse and are really passionate about this, I guess JBoss Seam might be a better solution. If you want to use JSF or Wicket, go for JBoss Seam, while if you want to use Spring MVC or GWT, use Spring Roo (for other web frameworks it probably doesn't really matter which you choose, though Spring roo might then be a better solution). And if 'adulthood' is your main point of decision, I guess you'd better use JBoss Seam. All in all deciding between the two can be really hard, but at least know that both solutions are really great and will help you a lot, either way.

By the way, make sure to keep an eye on the JBoss Forge project as the current seam-gen solution will be replaced in the near future with this promising project.

謸气贵蔟 2024-10-10 17:00:49

锻造它 -> http://forge.jboss.org

如果你是新手,只要坚持,你就会拥有一个 Web 应用程序、测试和安全。还有更多。

如果您了解 Java,您将拥有与上面相同的知识,以及如何制作优秀应用程序的惊人知识来源:Forge 生成的源代码和资源。您可以学到很多关于 Java EE(CDI、Validation、JSF)、maven、JPA、tiles、EJB...等等的知识。

Just Forge it -> http://forge.jboss.org

If you are a novice, you'll have a web application, with persistence, tests and security. And more.

If you know Java, you'll have the same as above plus an amazing source of knowledge of how to make good applications: the source code and resources generated by Forge. You can learn a lot about Java EE (CDI, Validation, JSF), maven, JPA, tiles, EJB... And many more.

妄断弥空 2024-10-10 17:00:49

就Roo吧。

如果您是新手,您将拥有一个具有持久性、测试性和安全性的 Web 应用程序。还有更多。

如果您了解 Java,您将拥有与上面相同的知识,以及如何制作优秀应用程序的惊人知识来源:Roo 生成的源代码和资源。你可以学到很多关于Spring(核心、安全、MVC)、maven、JPA、tiles、messagign...等等的知识。

Just Roo it.

If you are a novice, you'll have a web application, with persistence, tests and security. And more.

If you know Java, you'll have the same as above plus an amazing source of knowledge of how to make good applications: the source code and resources generated by Roo. You can learn a lot about Spring (core, security, MVC), maven, JPA, tiles, messagign... And many more.

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