Spring Roo 的前提条件是什么

发布于 2024-10-24 17:12:47 字数 443 浏览 2 评论 0原文

我在 Spring Roo 中亲自动手,成功地为 Oracle 数据库设置了持久性。虽然我已经阅读了 Roo 文档 但这对我来说还不够理解这个框架的工作

我不知道 Spring-MVCSpring-Web FlowAspectJ 但我了解 Struts、Tapestry 和 GWT 等框架。这会不会成为学习 Spring Roo 的障碍呢?

请提供建议,因为我已经失去了破解 Spring Roo 生成的代码的耐心。
我加入 Spring Roo 项目是个好主意吗?

I have got my hands dirty in Spring Roo, I have managed to do the persistence set up for Oracle Database. Although I have gone through the Roo documentation
but it not enough for me to understand the working of this framework.

I'm not aware of Spring-MVC ,Spring-Web Flow and AspectJ rather I have knowledge of frameworks such Struts, Tapestry and GWT. Could this be a hindrances in learning Spring Roo.

Please advice as I'm running out of patience of hacking the generated code by Spring Roo.
Is it good idea for me to jump in a Spring Roo project?

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

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

发布评论

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

评论(3

自由如风 2024-10-31 17:12:47

Spring Roo 不仅仅是一个代码生成器。如果您对实体进行更改,它将自动更改代码。更像是一个有状态的代码生成器。首先,您需要找出 Spring Roo 中可用于配置项目的命令。

您可以配置要使用哪个数据库、要使用哪个orm、是否要使用单元测试或要使用哪种视图技术。下达命令,Roo 就会负责。您无需担心要下载哪些库、如何为 Maven 制作 pom 文件。

使用 Spring Roo 获得的配置是相当标准的配置。我在之前的项目中使用过它。生成的代码不是最优的,例如,如果您认为生成的代码很冗长,您可以使用通用 daos 而不是 Roo 生成的 DAO。

另一个例子是,在Flex中,您可以使用Roo来生成Flex客户端和J2EE服务器之间通信的配置。就我而言,我对 Flex 客户端使用欧芹和观察者模式,而不是 Spring Roo 生成的代码。但通过查看 Roo-Flex 团队编写的代码,我也学到了很多东西。 GWT 和 Spring MVC 也是如此。

所以我想说的是,作为程序员,我们不仅需要编码,我们还需要阅读别人写的东西。我坚信这是学习和分享最佳实践的好方法。您可能会得到一些样板代码,但如果您知道如何应用设计模式或可以对其进行增强,那么这些代码将成为宝石。

学习曲线 ?一点也不。命令就像 DOS 命令一样简单。

The Spring Roo is more than a code generator. If you make changes in your Entities, it will change the codes automatically. More like a stateful code generator. First you need to find out the commands available in Spring Roo to configure a project.

You can configure which database you want to use, which orm you want to use, whether you want to use unit-tests or which view technology you want to use. Give the commands and Roo takes care of it. You don't need to worry about which libraries to download, how to make pom file for Maven.

The configurations you got using Spring Roo is quite a standard one. I used it in the previous projects. The code generated is not optimal, for example , you can use generic daos instead of Roo generated DAO if you consider the generated codes are verbose.

Another example says, in Flex, you can use Roo to generate configurations for the communication between Flex client and J2EE server. For my case, I use parsley and observer patterns for flex client instead of the codes generated by Spring Roo. But by looking at the codes what the Roo-Flex team wrote taught me quite a lot of things too. The same things goes for GWT and Spring MVC.

So what am I saying is that as the programmers, we need not only to code we also need to read what the other wrote too . I strongly believe that it is a good way to learn and share best practices. You might get some boilerpate codes, but if you know how to apply design patterns or can enhance on them, those codes will become the gems.

Learning curve ? Not at all. The commands are as simple as DOS commands.

痴骨ら 2024-10-31 17:12:47

Spring ROO 只是一个命令行界面,用于生成许多在 Java 项目中完成工作时通常需要编写的样板代码。

如果您想将 GWT 添加到您的项目中,只需在创建模型后输入“gwt setup”即可,并且您的项目将获得全面的 GWT 支持。

Roo 中生成的默认视图使用 Apachetiles,类似于 Struts、Tapestry 和 JSF。

如果你想使用 web flow,只需输入“web flow”,它就会为你集成,对于 struts 支持,你需要一个插件,我见过其中几个在网络上漂浮,还没有t 测试了其中任何一个; Tapestry 也是如此,您可以使用 Tapestry 插件或手动进行集成。

Roo 生成的脚手架上下文中的 AspectJ 用于隐藏所有使代码看起来像意大利面条的样板代码,您可以将代码从aspectJ 生成的文件移出到您自己的 java 文件中,并在需要时修改它们。

至于黑客攻击,需要大量的耐心和时间来完全理解哪些地方应该改变,哪些地方不应该改变,我只能说,快乐的黑客攻击:-)

Spring ROO is just a command line interface for generating a lot of the boiler plate code you usually need to write to get things done in java projects.

If you want to add GWT into your project, just type "gwt setup" after you've created your models and you have full-on GWT support in your project.

The default view being generated in Roo uses Apache tiles, similar to Struts, Tapestry and JSF.

If you want to use web flow, just type in "web flow" and it'll be integrated for you, for struts support, you'll need a plugin, I've seen a couple of them floating around the web, haven't tested any of them; same goes for tapestry, you can either use a tapestry plugin or do the integration by hand.

AspectJ in the context of Roo generated scaffold is used to hide all the boilerplate code that makes code look like spaghetti, you can move code out of the aspectJ generated files into your own java files and modify them if you need to.

As for the hacking, it takes a lot of patience and time to fully understand where you should change stuff and where you shouldn't, all I can say is, happy hacking :-)

你的心境我的脸 2024-10-31 17:12:47

springroo 基于许多技术,但 springroo 所做的只是帮助您使用大量可以安装的插件生成脚手架代码,

至少这是我在学习了三天后对这个框架的看法

springroo is based on many technologies, but all what springroo does is to help you to generate scaffolding code using lots of addons you can install

at least it's my view of this framework after three days of learning it

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