简体   繁体   English

EJB vs Spring + POJO

[英]EJB vs Spring + POJO

What advantages does EJB have to be stacked with Spring? EJB必须与Spring堆叠有什么优势? Why couldn't I just use Spring Entity Manager, Security, and POJOs to do what EJB does? 为什么我不能只使用Spring Entity Manager,Security和POJO来做EJB所做的事情?

They overlap a lot, but still distinguished in some areas. 它们重叠很多,但在某些方面仍然有所区别。 For example Spring is very good in light weight remoting, and have a rich AOP support etc. EJB, on the other hand, is very good in state management (stateful session beans), distributed transactions etc. Spring lacks instance pooling, activation/passivation and all. 例如,Spring在轻量级远程处理方面非常出色,并且具有丰富的AOP支持等。另一方面,EJB在状态管理(有状态会话bean),分布式事务等方面非常出色.Spring缺乏实例池,激活/钝化和所有。 Also, I found it handy to convert your component into a web service using EJB 3. 此外,我发现使用EJB 3将组件转换为Web服务非常方便。

Look both as complimentary technologies, to get the most out of them. 将两者视为互补技术,以充分利用它们。

I see them as complementary. 我认为它们是互补的。 In other words, it's not one or the other. 换句话说,它不是一个或另一个。

We develop with Spring and all the facilities it offers, and then deploy onto an EJB container. 我们使用Spring及其提供的所有工具进行开发,然后部署到EJB容器上。 Most of the time however you will not require session beans, servlets will suffice. 但是大多数情况下你不需要会话bean,servlet就足够了。 That's the advantage of Spring. 这就是Spring的优势。

By developing on top of Spring your application does not depend on any application server. 通过在Spring上进行开发,您的应用程序不依赖于任何应用程序服务器。 It can practically run stand alone, that means you can run tests without a container (Spring does the transactionalisation and life cycle management for you). 它实际上可以独立运行,这意味着您可以在没有容器的情况下运行测试(Spring会为您执行事务化和生命周期管理)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM