为什么大公司更喜欢 Spring 而不是 Java EE?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23244894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why do large companies prefer Spring over Java EE?
提问by Alex Kartishev
While looking for the job, i have attended some job interviews at companies, that work at financial sphere. Every company uses Spring Framework as main framework for development. And almost everywhere I was told 'We need proved and stable technologies, that is why we use Spring.'
在找工作的过程中,我参加了一些公司的工作面试,这些公司在金融领域工作。每个公司都使用 Spring Framework 作为主要的开发框架。几乎在任何地方我都被告知“我们需要经过验证且稳定的技术,这就是我们使用 Spring 的原因”。
I would like to know, as I can't understand, why Spring is more popular and 'safer', than Java EE (for example, Spring MVC is used more, than JSF, while both provide almost the same functionality)?
我想知道,因为我无法理解,为什么 Spring 比 Java EE 更流行和“更安全”(例如,Spring MVC 比 JSF 使用得更多,而两者都提供几乎相同的功能)?
How it is possible, that native Java EE functionalities are less stable, than third-libraries?
与第三方库相比,原生 Java EE 功能怎么可能不稳定?
采纳答案by rdllopes
Some reasons:
一些原因:
Spring was already there: J2EE was ugly (no Dependency Injection, no conversion over configuration and lot of scares from EJB2, ouch). Java EE "stole" all good ideas from Spring, and it is in fact lighter and easier than previous versions. But now, everybody already uses Spring. It means a lot of production code, lot of well tested products and so on. In the end, why do people in UK/USA use English units? (There is a huge cost to change)
Spring is lighter: You do not need a heavy Java EE application server, you can deploy your application in a web container such as Tomcat.
Spring offers a ton of features which are not available as Java EE standards, such as Spring Batch or Spring Integration. You can use Spring features with Java EE standards, but it should be supposed Spring works better with Spring, shouldn't it?
Spring Aspect-oriented programming is more flexible and power that Java EE interceptors. You can use third-party AOP with Java EE but you can have this out-of-the-box from Spring.
Spring moves faster. Spring can release often and faster because it is no standard and only one vendor. So, it is not required JCP ballots, approvals, etc. The reaction to market requirements is much faster. Some current examples: cloud, mobile, social computing.
Spring 已经在那里了:J2EE 很丑(没有依赖注入,没有配置转换,还有很多来自 EJB2 的恐惧,哎哟)。Java EE “窃取”了 Spring 的所有好主意,实际上它比以前的版本更轻巧、更容易。但是现在,每个人都已经在使用 Spring。这意味着大量的生产代码、大量经过良好测试的产品等等。最后,为什么英国/美国的人使用英文单位?(改变的代价很大)
Spring 更轻:您不需要繁重的 Java EE 应用服务器,您可以将您的应用部署在 Tomcat 等 Web 容器中。
Spring 提供了大量 Java EE 标准所不具备的功能,例如 Spring Batch 或 Spring Integration。您可以将 Spring 特性与 Java EE 标准结合使用,但应该认为 Spring 与 Spring 一起工作得更好,不是吗?
Spring 面向方面的编程比 Java EE 拦截器更加灵活和强大。您可以将第三方 AOP 与 Java EE 一起使用,但您可以从 Spring 中获得开箱即用的功能。
弹簧移动得更快。Spring 可以频繁发布,而且发布速度更快,因为它没有标准,只有一个供应商。因此,不需要 JCP 投票、批准等。对市场要求的反应要快得多。当前的一些示例:云、移动、社交计算。
Ironically, I have "got" a lot ideas from: http://www.kai-waehner.de/blog/2011/11/21/why-i-will-use-java-ee-jee-and-not-j2ee-instead-of-spring-in-new-enterprise-java-projects-in-2012/
具有讽刺意味的是,我“得到”了很多想法:http: //www.kai-waehner.de/blog/2011/11/21/why-i-will-use-java-ee-jee-and-not- j2ee-instead-of-spring-in-new-enterprise-java-projects-in-2012/
回答by Nathan Hughes
One thing that makes Spring attractive to developers, especially at big organizations like financial companies, is that it lets them take more control over their middleware. With pure Java EE, developers are at the mercy of an operations group that has very different goals than they have. In many cases operations wants to avoid messing with anything that works, every upgrade is a chance for things to go wrong, and it's not like they're the ones who see the benefits from upgrades, so that makes their choices very conservative. That can mean developers get stuck with obsolete versions of an application server, and if a problem comes up the developers have to work with the vendor's technical support (so you have to convince the vendor you have a problem and reproduce it under the conditions they specify), then coordinate with operations to implement the fix (which of course means justifying your request to an organization with different priorities from you). Developers like to minimize this kind of thing whenever possible.
让 Spring 对开发人员,尤其是金融公司等大型组织的开发人员有吸引力的一件事是,它让他们可以更好地控制他们的中间件。使用纯 Java EE,开发人员受制于与他们的目标截然不同的运营团队。在许多情况下,运营部门希望避免搞乱任何有效的东西,每次升级都是出错的机会,而且并不是他们看到了升级的好处,因此他们的选择非常保守。这可能意味着开发人员会被应用服务器的过时版本困住,如果出现问题,开发人员必须与供应商的技术支持合作(因此您必须说服供应商您遇到了问题并在他们指定的条件下重现问题) ), 然后与运营部门协调以实施修复(这当然意味着向与您具有不同优先级的组织证明您的请求是合理的)。开发人员喜欢尽可能减少这种事情。
Having Spring in the application gives the developers more freedom to update more of their infrastructure on their own schedule.
在应用程序中使用 Spring 使开发人员可以更自由地按照自己的时间表更新更多的基础设施。
回答by senseiwu
While looking for the job, I have attended some job interviews at companies, that work at financial sphere. Every company uses Spring Framework as main framework for development. And almost everywhere I was told 'We need proved and stable technologies, that is why we use Spring.'
在找工作的过程中,我参加了一些公司的工作面试,这些公司在金融领域工作。每个公司都使用 Spring Framework 作为主要的开发框架。几乎在任何地方我都被告知“我们需要经过验证且稳定的技术,这就是我们使用 Spring 的原因”。
I work in financial domain since several years - so I can speak from my experience.
我在金融领域工作了几年 - 所以我可以从我的经验中说出来。
Many financial service providers I know had a major upgrade to their enterprise software stack at around 2006-2008, at a time when the disillusion about EJBs were at its peak after several unmaintainable and poorly written EJB projects. So in-order to upgrade their system and also to attract developers, they began to re-implement their stuffs in Spring and Hibernate, also it was a logical step for them to start new projects in the state of the art frameworks(which at that time were Spring, Hibernate and Wicket)
我认识的许多金融服务提供商在 2006-2008 年左右对他们的企业软件堆栈进行了重大升级,当时在几个无法维护且编写不当的 EJB 项目之后,对 EJB 的幻想破灭达到顶峰。因此,为了升级他们的系统并吸引开发人员,他们开始在 Spring 和 Hibernate 中重新实现他们的东西,这也是他们在最先进的框架中启动新项目的合乎逻辑的步骤(当时时间是 Spring、Hibernate 和 Wicket)
But since then financial crisis broke out and not many financial service companies think of investing that much money in new development unless it is very critical. Most do not care whether Java EE 6 or 7 was launched and some of the old arguments do not hold good anymore or so.
但从那时起金融危机爆发,除非非常关键,否则没有多少金融服务公司会考虑在新开发项目上投入这么多资金。大多数人并不关心是 Java EE 6 还是 7 发布,一些旧的论点不再适用。
So they would like to believe that what they have is safer, fasteretc (which may or may not be true)
所以他们愿意相信他们拥有的东西更安全、更快等(这可能是也可能不是)