Java 为什么是 Spring 框架?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1610597/
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 Spring Framework?
提问by Rachel
I hear nowadays a lot about the Spring Framework. Why is there so much buzz around the Spring Framework in the industry?
我现在听到很多关于 Spring 框架的信息。为什么业界对 Spring 框架有如此多的热议?
采纳答案by Pascal Thivent
I already gave a partial answer in https://stackoverflow.com/questions/1549472/what-are-upcoming-trends-in-software-industry-and-its-impact-for-java-developer/1549740#1549740but I'll add some links in this answer. Actually, I won't cover or discuss the technical qualities of Spring as they aren't new and don't explain the buzz in my opinion. Instead, consider the following events and acquisitions:
我已经在https://stackoverflow.com/questions/1549472/what-are-upcoming-trends-in-software-industry-and-its-impact-for-java-developer/1549740#1549740 中给出了部分答案,但我将在此答案中添加一些链接。实际上,我不会涵盖或讨论 Spring 的技术特性,因为它们并不新鲜,也无法解释我认为的热门话题。相反,请考虑以下事件和收购:
- November 11, 2008: SpringSource Acquires G2One Inc.
- April 28, 2009: SpringSource tc Server – The logical next step
- May 4, 2009: SpringSource Plus Hyperic Unifies Application Lifecycle From Developer to Data Center
- Augustus 11, 2009: VMware Acquires SpringSource for $420 Million - Industry Reactions (Updated)
- Augustus 19, 2009: SpringSource Cloud Foundry is Launched
- 2008年11月11日:SpringSource的收购G2One公司。
- 2009 年 4 月 28 日:SpringSource tc Server——合乎逻辑的下一步
- 2009 年 5 月 4 日:SpringSource Plus Hyperic 统一了从开发人员到数据中心的应用程序生命周期
- 2009 年 8 月 11 日:VMware 以 4.2 亿美元收购 SpringSource - 行业反应(更新)
- 2009 年 8 月 19 日:SpringSource Cloud Foundry 发布
As you can see, there have been lots of changes in the SpringSource sphere during the past year, with some pretty big moves during this summer. Don't you see the big picture now? Well, look at the resulting stack: with Java, Groovy, Grails as languages, Spring as container, tc Server as underlying application server, Hyperic for health and monitoring, VMware for virtualization, CloudFoundry as management and provisioning system, VMware/SpringSource has a complete stack for elastic cloud. And by complete, I mean really complete as this stack covers everything - except the JVM - to put Java on the Cloud: the software, the platform and the infrastructure i.e. all the different flavors of cloud computing.
如您所见,在过去的一年中 SpringSource 领域发生了很多变化,今年夏天有一些相当大的变化。你现在没有看到大图吗?好吧,看看最终的堆栈:Java、Groovy、Grails 作为语言,Spring 作为容器,tc Server 作为底层应用服务器,Hyperic 用于健康和监控,VMware 用于虚拟化,CloudFoundry 作为管理和供应系统,VMware/SpringSource 有一个弹性云的完整堆栈。完整,我的意思是真正完整,因为这个堆栈涵盖了一切——除了 JVM——将 Java 放在云上:软件、平台和基础设施,即所有不同风格的云计算。
In other words, while others are still preparing themselves for it, VMware and SpringSource are already ready for the SaaS1/PaaS2/IaaS3wave.
换句话说,当其他人仍在为此做准备时,VMware 和 SpringSource 已经为 SaaS 1/PaaS 2/IaaS 3浪潮做好了准备。
This is exciting, this is where innovation goes, this creates (or at least feeds) the trend, this puts a lot of pressure on Java, the Application Server market, Java EE,... and this explains IMO the buzz around VMware/SpringSource. More than the upcoming arrival of Spring 3.0 :).
这是令人兴奋的,这就是创新的方向,这创造了(或至少推动了)趋势,这给 Java、应用服务器市场、Java EE 带来了很大压力……这解释了 IMO 围绕 VMware/弹簧源。不仅仅是即将到来的 Spring 3.0 :)。
1Software as a Service
2Platform as a Service
3Infrastructure as a Service
1软件即服务
2平台即服务
3基础设施即服务
回答by lomaxx
Well it provides a great additional framework that lets you concentrate on writing less framework code and more application code.
好吧,它提供了一个很棒的附加框架,让您可以专注于编写更少的框架代码和更多的应用程序代码。
It provides things like:
它提供以下内容:
- A fairly comprehensive IoC container
- An AOP Framework
- Messaging Framework
- 一个相当全面的 IoC 容器
- AOP 框架
- 消息框架
and a whole lot more.
还有更多。
A lot of these concepts are fairly complex and because they provide the framework it means you can just plug in their components and leverage what has already been created for you.
许多这些概念相当复杂,因为它们提供了框架,这意味着您可以插入它们的组件并利用已经为您创建的组件。
回答by pgb
I think you may want to read about dependency injection, and inversion of control.
Spring is (among several other things) an inversion of control container.
Spring 是(除其他外)控制容器的反转。
回答by DigitalRoss
Maybe something to do with US$420 million?
也许与4.2亿美元有关?
Spring has been around for a while, it introduced important new design patterns, and it is indirectly responsible for reforming EJB.
Spring 已经存在一段时间了,它引入了重要的新设计模式,并间接负责了EJB的改革。
But I'm thinking you are hearing about it now because in August, VMware bought SpringSource for $420 million. That's rather high for an open source developer and consulting company...
但我想你现在已经听说了,因为 8 月份,VMware 以 4.2 亿美元收购了 SpringSource。对于开源开发人员和咨询公司来说,这是相当高的......
回答by RogerV
In the primordial days of crusty old J2EE, Spring Framework came along and made it possible to inject JNDI registered services into EJBs. Gee, you could actually begin to design an EJB to where it could be unit tested without having to fire up a J2EE app server - just mock the JNDI services that it collaborated with via Spring dependency injection.
在顽固的旧 J2EE 的原始时代,Spring Framework 出现并使得将 JNDI 注册服务注入到 EJB 中成为可能。哎呀,您实际上可以开始设计一个 EJB,使其可以进行单元测试,而无需启动 J2EE 应用程序服务器——只需模拟它通过 Spring 依赖注入与之协作的 JNDI 服务。
Well, for it's day, that was a not so minor miracle.
好吧,就今天而言,那可不是个小奇迹。
These days, if you want to know why Spring continues to rock, check out this book and learn about this development stack, and how Spring is instrumental as the core bean factory mechanism to everything that surrounds it - from BlazeDS services to iBATIS or Hibernate to ActiveMQ messaging beans:
如今,如果您想知道 Spring 为何持续流行,请查看这本书并了解此开发堆栈,以及 Spring 如何作为核心 bean 工厂机制发挥作用于围绕它的一切——从 BlazeDS 服务到 iBATIS 或 Hibernate 到ActiveMQ 消息传递 bean:
And check out this article:
并查看这篇文章:
回答by muhammed Younus attari
Let me try to explain you why spring, what is there in spring and what made spring so popular.
让我试着向你解释为什么春天,春天里有什么,是什么让春天如此受欢迎。
The basic Idea of Spring Framework is
Spring 框架的基本思想是
You do not create an object, but describe how they should be created, by defining is Spring Config file
You do not call a services and components, but tell which services and components must be called, by defining in spring configuration files
您不创建对象,而是通过定义 Spring Config 文件来描述它们应该如何创建
您不调用服务和组件,而是通过在 spring 配置文件中定义来告诉必须调用哪些服务和组件