Java EE 和 Spring 框架的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4490682/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 04:15:53  来源:igfitidea点击:

Difference between Java EE and Spring framework

springspring-mvcjakarta-ee

提问by Sid

I am striving to know the difference between Java EE and Spring Framework. Could anyone please help me on this.

我正在努力了解 Java EE 和 Spring Framework 之间的区别。任何人都可以帮我解决这个问题。

回答by Pablo Santa Cruz

Java EE is an standard, official, specification for a full featured Enterprise Application Framework stack. Includes stuff like Object-Relational Mapping, Security, Web Applications, database connectivity, transactions...

Java EE 是全功能企业应用程序框架堆栈的标准、官方规范。包括对象关系映射、安全性、Web 应用程序、数据库连接性、事务...

On top of Java EE specifications there are JavaEE implementations/application serverslike: JBoss, Glassfish, WebSphere, Weblogic.

在 Java EE 规范之上还有 JavaEE实现/应用服务器,例如:JBoss、Glassfish、WebSphere、Weblogic。

Spring on the other hand, is a framework doing lots of the stuff on the Java EE specifications, but in its own form. They don't follow Java EE specifications and APIs for that. But they do include a Web Framework, transaction management, security and several other solutions Java EE offers.

另一方面,Spring 是一个框架,它在 Java EE 规范上做了很多事情,但以它自己的形式。他们不遵循 Java EE 规范和 API。但它们确实包括 Web 框架、事务管理、安全性和 Java EE 提供的其他几个解决方案。

回答by sun007

Java EE:

Java EE:

  1. Java EE industry approved standard API based framework
  2. It is predominantly based on annotations and CDI
  3. JFC MVC framework for web development
  4. JPA specification to process DB operation
  5. JTA API with implementation
  6. EJB container and POJO based implementation
  7. Oracle license
  1. Java EE 行业认可的基于标准 API 的框架
  2. 它主要基于注释和 CDI
  3. 用于 Web 开发的 JFC MVC 框架
  4. 处理DB操作的JPA规范
  5. 带实现的 JTA API
  6. 基于 EJB 容器和 POJO 的实现
  7. 甲骨文许可证

Spring:

春天:

  1. Based on IOC and AOP
  2. Based on XML configuration (now they are leveraging annotation)
  3. Uses Spring DAO framework (based on Template design pattern) to connect to database
  4. Provides abstraction layer to support various JTA implementation vendor
  5. Integrates with various Java vendors to support different capabilities such as struts etc
  6. Provides end-to-end platform to build web application achieving loose coupling using DI and AOP
  7. Open source license
  1. 基于IOC和AOP
  2. 基于 XML 配置(现在他们正在利用注释)
  3. 使用Spring DAO框架(基于模板设计模式)连接数据库
  4. 提供抽象层以支持各种 JTA 实现供应商
  5. 与各种 Java 供应商集成以支持不同的功能,例如 struts 等
  6. 提供端到端平台来构建使用 DI 和 AOP 实现松耦合的 Web 应用程序
  7. 开源许可证

回答by duffymo

Java EE:

Java EE:

  1. A Sun/Oracle standard that app server vendors conform to
  2. Based on Enterprise Java Beans
  3. Implemented by many vendors: BEA/Oracle, WebSphere, JBOSS, Glassfish, etc.
  1. 应用服务器供应商遵守的 Sun/Oracle 标准
  2. 基于 Enterprise Java Beans
  3. 由许多供应商实施:BEA/Oracle、WebSphere、JBOSS、Glassfish 等。

Spring:

春天:

  1. Not a standard; it's the brainchild of Rod Johnson and implemented by Spring/VMWare.
  2. Not based on Enterprise Java Beans; it's a POJO model. Can manage EJBs if you wish to use them, but not required.
  3. Not implemented by any vendor other than Spring.
  1. 不是标准;它是 Rod Johnson 的创意,由 Spring/VMWare 实现。
  2. 不基于 Enterprise Java Beans;这是一个 POJO 模型。如果您希望使用 EJB,则可以管理它们,但不是必需的。
  3. 未由 Spring 以外的任何供应商实现。

EJB 3.1 has taken a great deal from Spring. Now it includes dependency injection, a form of aspects, and JPA. EJB 3.1 is much closer to Spring than EJB 2.0 was.

EJB 3.1 从 Spring 中吸取了很多东西。现在它包括依赖注入、一种形式的方面和 JPA。EJB 3.1 比 EJB 2.0 更接近 Spring。

回答by Arjan Tijms

I provided an overview of Java EE here Frameworks for Layering reusable Architectures

我在这里概述了 Java EE分层可重用架构的框架

This also contains a small comparison with Spring, which might be relevant for this question.

这也包含与 Spring 的一个小比较,这可能与这个问题有关。