java OSGi vs Spring vs Struts vs EJB vs. Hibernate——一个完全新手的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3579418/
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
OSGi vs Spring vs Struts vs EJB vs. Hibernate -- a totally newbie's question
提问by sean
I am not familiar with these "framework" "components" at all, but can someone give me a 101 introduction about what the relationship they are to each other? Basically, I want to know roughly about:
我对这些“框架”“组件”完全不熟悉,但是谁能给我101介绍一下它们之间的关系?基本上,我想大致了解:
what and what are counterparts to each other
what and what are complementary technology (e.g., A as a framework can be used with B as a component)
what big names have I missed above list which I should not have?
什么和什么是彼此的对应物
什么和什么是互补技术(例如,A作为框架可以与B作为组件一起使用)
我在上面的列表中遗漏了哪些我不应该拥有的大牌?
Can anyone give me a high level intro? After reading the first two answers, can someone give more explanation about Spring vs. OSGi -- are they in separate market (Enterprise vs. Mobile)?
谁能给我一个高水平的介绍?阅读前两个答案后,有人可以对 Spring 与 OSGi 给出更多解释——它们是否在不同的市场(企业与移动)?
Many thanks
非常感谢
回答by Bozho
The "vs" is incorrect, because many of these can be used together.
“vs”是不正确的,因为其中许多可以一起使用。
OSGi is a modularization technique (rather than a framework). It gives you the ability to separate your software in independent modules that can co-exist in different versions, with and without other modules
Spring - lightweight dependency injection container. It allows you to wire your components by defining their dependencies and letting the framework instantiate and configure them, thus allowing for greater flexibility (couldn't say more buzzwords here).
Struts - an MVC, action-based framework - used in the web tier
EJB - The business componnets of JavaEE - you place your business logic in Enterprise JavaBeans, and you have transaction handling, state handling, (JMS) message consumption, timers, etc out of the box
Hibernate - an ORM (object-relational mapping) solution - basically it allows you to work with objects(oop) when you have a relational database as a data storage.
OSGi 是一种模块化技术(而不是框架)。它使您能够将软件分离为独立模块,这些模块可以在不同版本中共存,有或没有其他模块
Spring - 轻量级依赖注入容器。它允许您通过定义组件的依赖项并让框架实例化和配置它们来连接组件,从而提供更大的灵活性(这里不能说更多的流行语)。
Struts - 一个 MVC、基于动作的框架 - 用于 web 层
EJB - JavaEE 的业务组件 - 您将业务逻辑放在 Enterprise JavaBeans 中,并且您拥有开箱即用的事务处理、状态处理、(JMS) 消息消费、计时器等
Hibernate - 一种 ORM(对象关系映射)解决方案 - 基本上它允许您在将关系数据库作为数据存储时使用对象(oop)。
回答by oxbow_lakes
Well, you could probably try and read something about them?
好吧,您可能可以尝试阅读有关它们的内容?
- Struts- is a framework for creating websites on top of the Java servlet "technology"
- Spring- is a dependency-injection "container" for managing the configuration of Java programs (i.e. wiring your components together)
- Hibernate- is an object-relational mapping framework for bridgingrelational databases (RDMS) and object-oriented programs.
- EJB- is part of the Java Enterprise Edition specification. The point of these were to sell lots of expensive application servers from Oracle, BEA and IBM. They failed(well, a bit); hence Spring
- OSGi- is a "container" for managing an application made of multiple components, where you wish to swap out implementations of modules (or upgrade them) without restarting the system. It started out oriented towards the mobile phone market and I've never really encountered it "in the enterprise"
- Struts- 是在 Java servlet“技术”之上创建网站的框架
- Spring- 是一个依赖注入“容器”,用于管理 Java 程序的配置(即将你的组件连接在一起)
- Hibernate- 是一种对象关系映射框架,用于桥接关系数据库 (RDMS) 和面向对象的程序。
- EJB- 是 Java Enterprise Edition 规范的一部分。这样做的目的是出售大量来自 Oracle、BEA 和 IBM 的昂贵应用服务器。他们失败了(好吧,有点);因此春天
- OSGi- 是一个“容器”,用于管理由多个组件组成的应用程序,您希望在其中交换模块的实现(或升级它们)而无需重新启动系统。它最初是面向手机市场的,我从未真正在“企业”中遇到过
These are to some extent orthogonaltechnologies, i.e. they are not mutually exclusive. Spring is now complementary with OSGi, for example, and servlet technology is a subset of Java EE.
这些在某种程度上是正交的技术,即它们并不相互排斥。例如,Spring 现在与 OSGi 互补,而 servlet 技术是 Java EE 的一个子集。

