使用 Spring 3 启动项目
在工作中,我们有一个(大型……团队有十几个人,需要 1-2 年的开发)项目即将启动,“高层”正在考虑将 Spring 3 作为 Web 框架(营销热议。 .. 任何)。
这不是一个简单的 Web 应用程序,我们没有 Spring 3 的经验(尽管我们已经有一些 Spring 2 的经验......但我们绝不是专家)。我们应该学习 Spring 3 并开始编码。
但我有一种感觉,我们会度过一段艰难的时光。
Spring 3 GA 已经推出一年左右了,书籍似乎还没有跟上。到目前为止,我发现有 Pro Spring 3 和正在运行的 Spring 第三版,涵盖了 Spring 3。在线教程不是很复杂,看起来参考资料就是我们作为坚实基础所拥有的全部内容(这是一个简洁的内容)。文档)。
正如我所说,我有一种不好的预感。不要误会我的意思,我不介意学习 Spring 3(容易或困难),但我不确定“项目的安全性”(大项目,小时间框架......死亡行军的味道)如果我们选择 Spring 3。
我正在呼吁您的体验。您是否使用 Spring 3 创建过大型项目?您遇到了什么问题?
At work we have a (large... 1-2 years of development ahead with a dozen of people in the team) project that will soon start and the "higher ups" are considering Spring 3 as the web framework (marketing hot air... whatever).
This is not a trivial web application and we don't have experience with Spring 3 (although we have some experience with Spring 2 already... but we're by no means experts). We are supposed to learn Spring 3 and start coding.
But there is this feeling I have that we'll have a hard time.
Spring 3 GA is around for an year or so and books seem not to have yet catched up. There is Pro Spring 3 and the third edition of Spring in action that I found so far covering Spring 3. The online tutorials are not very complex, and it seems the reference is all we've got as a solid foundation (which is a terse document).
As I said, I have a bad feeling. Don't get me wrong I don't mind learning Spring 3 (easy or hard going) but I'm not sure about the "safety of the project" (large project, small time frame... smell of death march) if we go with Spring 3.
I'm making an appeal to your experience. Have you created large projects with Spring 3? What issues did you encounter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Spring 3 与 Spring 2 / 2.5 相距不到百万光年。如果您对 Spring 和 Spring MVC 有一定的经验,那么就去吧。
但请记住,Spring MVC 并不是最好的 Web 框架。它只是将相同的旧概念向前推进了一点。
如果您想要以网站的理念来完成一些事情,请尝试 Scala Lift、JRuby + Rails 或 PlayFramework。我并不是说您应该用 scala 或 Ruby 编写所有内容,而是检查这些框架是否为您提供了 Web 部分的优势,并使用任何 Java 技术(例如 spring IOC)来构建您的逻辑。
此外,如果该应用程序的架构师希望安全性高于潜在的快速交付,那么 Spring 3 是一个不错的选择。
SpringMVC(与 JSP 或 JSTL 一起使用)的缺点之一是它并不是真正基于组件的框架,因此它对于复杂的富客户端来说并不理想。
顺便说一句,我在一个小型网站上使用 spring 3 + MVC,有相当多的后端处理,我对此非常满意。
Spring 3 is not million light years away from Spring 2 / 2.5. If you have quite some experience with spring and spring MVC, then go for it.
But bear in mind that spring MVC is not the best web framework out there. It just takes the same old concepts a bit further ahead.
If you want something that was done with the idea of websites in mind, try Scala Lift, JRuby + Rails or PlayFramework. I'm not saying that you should code everything in scala or Ruby, but check if those frameworks give you an edge on the web part, and use any Java technology (such as spring IOC) to build your logic.
Also, if the Architects of that application want security over potential fast delivery, Spring 3 is a good choice.
One of the downsides of SpringMVC (used with JSP or JSTL) is that is not really component based framework, so it's not ideal for complex, rich clients.
As a side note, I'm using spring 3 + MVC on a small web site with quite a lot of backend processing and I'm very happy with it.
我建议你看看Spring Roo:
http://www.springsource.org/roo
和STS:
http://www.springsource.com/products/springsource-tool-suite-download
使用这些工具,您可以在 10 分钟内生成一个应用程序,从字面上看,该应用程序具有数据库访问层,其中包含从数据库、授权和数据库反向工程的丰富域对象。身份验证(Spring Security)、Web UI 层(不同选项)、日志记录。它可能不会满足您的需求,但它是实际了解 Spring 3 应用程序“应该”是什么样子的绝佳选择。 (在 STS 中,有一个称为“推入”重构的重构选项,一旦生成骨架,您就可以摆脱 Roo)
SpringSource 的 YouTube 频道也是一个很好的信息来源: http://www.youtube.com/user/SpringSourceDev
Spring 是一个伟大的框架系列,但您应该记住,它是不太使用它很容易做正确的事情,但以错误的方式使用它可能会给自己带来麻烦。
一般来说,我绝对会推荐 Spring,但如果您的时间安排不允许您花一些时间学习细节,您可能应该坚持使用已知的技术堆栈。
I would suggest to you to check out Spring Roo:
http://www.springsource.org/roo
and STS:
http://www.springsource.com/products/springsource-tool-suite-download
With these tools you are able to generate an app within 10minutes, literally, with database access layer with rich domain objects reverse engineered from your database, authorization & authentication (Spring Security), web UI layer (different options), logging. It will probably not suit your needs but it's an excellent option to actually see how a Spring 3 app 'should' look like. (In STS there is a refactor option called 'push-in' refactor which enables you to get rid of Roo once your skeleton is generated)
Also a great source of information is the YouTube channel of SpringSource: http://www.youtube.com/user/SpringSourceDev
Spring is a great family of frameworks, but you should keep in mind that it's not very easy to do things right with it and by using it the wrong way you can get yourself in trouble.
Generally I would absolutely recommend Spring, but if your timeframe doesn't allow you to spend some time learning the details, you should probably stick to your known technology stack.
我在我的项目中使用 Spring 3。它在概念上与 2/2.5 没有太大区别,同时添加了很多快捷方式,可以用更少的 xml(和代码)实现相同的优点。
我不喜欢 Spring 的一点是类名/接口/包对我来说就像一篇文章:
org.springframework.somemodule.somethingmorespecififc.FooSomethingWithBlahContextInBar
另外,如果你不使用 Maven 并尝试手动包含jar,你就注定了。然而,大型项目应该使用 maven :)
也就是说,Spring Ioc 对于任何规模的应用程序都是绝佳的选择。不过,我并不是 Spring MVC 的忠实粉丝,到目前为止还从未在项目中真正使用过它。但大多数 Java Web 框架都很糟糕。
使用 Spring,应用程序配置变得轻而易举,例如设置 DataSource(连接池)、EntityManager 等。与各种框架的集成也更加容易,例如 Struts2、Hibernate (JPA)、Velocity/Freemarker。通过 Spring LDAP 的 LDAP(和 Active Directory)非常棒(我们正在使用它)。
最后,Spring 安全性本身可能是在大型项目中使用 Spring 的唯一原因。
您几乎可以立即使用 appfuse 尝试 Spring 3。
I am using Spring 3 in my projects. It is conceptually not very different from 2/2.5, at the same time adds lot of shortcuts for achieving the same goodness with less xml (and code).
The thing that i don't like about Spring is the class names/interfaces/packages look like an essay to me :
org.springframework.somemodule.somethingmorespecififc.FooSomethingWithBlahContextInBar
Also if you are not using Maven and try to include jar manually, you are doomed. However, large projects should use maven :)
That said, Spring Ioc is excellent choice for any size of application. I am not a huge fan of Spring MVC though and never really used it in project so far. But most java web framework suck.
With spring, application configuration is breeze, like setting up DataSource (connection pool), EntityManager etc. Integration with various frameworks is also much easier like Struts2, Hibernate (JPA), Velocity/Freemarker. LDAP (and Active Directory) via Spring LDAP is awesome, (we are using it).
and Finally Spring security itself can be the sole reason to use Spring in a large project.
You can give a shot to spring 3 using appfuse in almost no time.
这取决于您对“大型项目”的定义是什么。也就是说,我已经使用 Spring 多年了; Spring 3 是第一个重大修订版,它真正将 Spring 打造成一个易于使用的框架,我很高兴对其有任何形式的依赖。
Spring 2.5 是朝着正确方向的飞跃,但 Spring 3 是一个重大改进。 Spring MVC 就可以了;在我看来,这不是很棒,但很实用。
但就 Spring 3 本身而言,我对将其用作技术平台没有任何疑虑,尽管您应该考虑是否信任 SpringSource/VMWare。 (也就是说,我没有任何理由说不信任 SpringSource,尽管他们对 OSGi 和云计算的理解......很奇怪。)
Spring 不会对项目的生命周期产生负面影响,并且为项目编写代码在 Spring 中使用往往会使代码质量更高,因为利用注入框架往往会产生更容易的测试。
It depends on what your definition of "large project" is. That said, I've been using Spring for years; Spring 3 is the first major revision that really kickstarted Spring as an easy-to-use framework that I was happy to have any sort of dependency on.
Spring 2.5 was a leap in the right direction, but Spring 3 is a major improvement. Spring MVC is all right; it's not fantastic IMO but it's serviceable.
But as far as Spring 3 itself is concerned, I'd not have any qualms whatsoever with using it as a technology platform, although you should consider whether you trust SpringSource/VMWare. (That said, I don't have any reason to say NOT to trust SpringSource, although their understandings of OSGi and cloud computing are... odd.)
Spring will have no negative impact on the life of the project, and writing code for use in Spring tends to make the code of higher quality because leveraging injection frameworks tends to yield easier testing.