Spring vs EJB。 Spring可以取代EJB吗? [英] Spring vs EJB. Can Spring replace EJB?

查看:131
本文介绍了Spring vs EJB。 Spring可以取代EJB吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 Spring 能够像 EJB 。对我来说,Spring能够取代使用EJB的要求。谁能告诉我使用EJB有什么额外的好处?

Since Spring is able to use transactions just like EJB. For me, Spring is able to replace the requirement of using EJB. Can anyone tell me what are the extra advantages of using EJB?

推荐答案

Spring从一开始就是作为EJB的替代品而开发的,所以答案当然是你可以使用Spring来实现EJB。

Spring was developed as an alternative to EJB right from its inception, so the answer is of course you can use Spring in place of EJBs.

如果使用EJB有优势,我会说这取决于团队的技能。如果你没有Spring专业知识和大量的EJB经验,那么坚持使用EJB 3.0是一个很好的举措。

If there's an "advantage" to using EJBs, I'd say that it would depend on the skills of your team. If you have no Spring expertise, and lots of EJB experience, then maybe sticking with EJB 3.0 is a good move.

为支持EJB标准而编写的应用服务器可以,理论,从一个兼容的Java EE应用服务器移植到另一个。但这意味着要远离任何特定于供应商的扩展,将您锁定到一个供应商。

App servers written to support the EJB standard can, in theory, be ported from one compliant Java EE app server to another. But that means staying away from any and all vendor-specific extensions that lock you in to one vendor.

应用服务器之间的弹出端口(例如,WebLogic,Tomcat,JBOSS)等等因为它不依赖于它们。

Spring ports easily between app servers (e.g., WebLogic, Tomcat, JBOSS, etc.) because it doesn't depend on them.

然而,你被锁定在Spring中。

However, you are locked into Spring.

Spring鼓励良好的OO设计实践(例如,界面,层次,关注点分离),即使您决定切换到Guice或其他DI框架,也可以使他们接触的任何问题受益。

Spring encourages good OO design practices (e.g., interfaces, layers, separation of concerns) that benefit any problem they touch, even if you decide to switch to Guice or another DI framework.

更新:这个问答在2014年是五年之久。需要说的是,编程和应用程序开发的世界在那个时代发生了很大的变化。

Update: This question and answer are five years old in 2014. It needs to be said that the world of programming and application development have changed a great deal in that time.

它不再只是Java或C#,Spring或EJB之间的选择。使用 vert.x ,可以完全避开Java EE。您可以在没有应用服务器的情况下编写高度可扩展的
多语言应用程序。

It's no longer just a choice between Java or C#, Spring or EJBs. With vert.x it's possible to eschew Java EE altogether. You can write highly scalable, polyglot applications without an app server.

更新:现在是2016年3月。 Spring Boot提供了一种更好的方法来编写没有Java EE应用服务器的应用程序。您可以创建一个可执行的JAR并在JVM上运行它。

Update: It's Mar 2016 now. Spring Boot offers an even better way to write applications without Java EE app servers. You can create an executable JAR and run it on a JVM.

我想知道Oracle是否会继续支持Java EE规范。 Web服务已经接管了EJB。 EJB解决方案已经死了。 (只是我的意见。)

I wonder if Oracle will continue to support the Java EE spec. Web services have taken over for EJBs. The EJB solution is dead. (Just my opinion.)

这篇关于Spring vs EJB。 Spring可以取代EJB吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆