Spring 与 Java EE 7

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

Spring vs Java EE 7

springjava-ee-7

提问by Korobko Alex

Now I am reading "Begining Java EE 7". And I was wondered that Java EE 7 is a good stack of technologies, it includes CDI, bean validation, JSF for web tier and other specifications.

现在我正在阅读“Begining Java EE 7”。我想知道 Java EE 7 是一个很好的技术堆栈,它包括 CDI、bean 验证、用于 Web 层的 JSF 和其他规范。

So I got a question:
Why should I study Spring framework if Java EE 7 exists and covers all capabilities which Spring implements?

所以我有一个问题:
如果 Java EE 7 存在并且涵盖了 Spring 实现的所有功能,我为什么要研究 Spring 框架?

回答by Ankur

I will share little bit of what I know about using Spring. You are right by saying that Java EE 7 has all the technologies to help solve the problems.

我将分享一些我对使用 Spring 的了解。您说的对,Java EE 7 拥有帮助解决问题的所有技术。

Well Spring just enhances these capabilities and makes life more easier for a developer.

好吧,Spring 只是增强了这些功能,让开发人员的生活更轻松。

As an example when you use Spring MVC framework you can use Spring UI tags to create your JSP and those tags in turn can help you map the values directly to your controller. By controller I mean the Java class which is invoked when you do form submit. It also helps you to validate the form data.

例如,当您使用 Spring MVC 框架时,您可以使用 Spring UI 标记来创建 JSP,而这些标记又可以帮助您将值直接映射到控制器。我所说的控制器是指在您提交表单时调用的 Java 类。它还可以帮助您验证表单数据。

This can be achieved using the Servlet technology also but Spring lets you focus on business logic and it takes care of these.

这也可以使用 Servlet 技术来实现,但 Spring 让您专注于业务逻辑并处理这些。

In my experience as a developer its good to know and understand Java EE 7 but frameworks like Spring utilize some of the best practices and patterns to make life easier for developers.

根据我作为开发人员的经验,了解和理解 Java EE 7 是件好事,但 Spring 等框架利用了一些最佳实践和模式,让开发人员的生活更轻松。

Would like to hear the opinions from others as well.

也想听听别人的意见。

Hope this helps.

希望这可以帮助。

回答by umanganiello

I think that one simply should know both of them. Spring has a huge community and is used widely, but Java EE is now going forward too, using many technologies that are in Spring in its latest versions.

我认为一个人应该知道他们两个。Spring 拥有庞大的社区并被广泛使用,但 Java EE 现在也在向前发展,使用 Spring 最新版本中的许多技术。

However, it is incorrect to say that Java EE covers all the fields that Spring does. In my opinion Spring still has something that could make the difference, if you work in particular domains, such as mobile (Spring mobile), social (Spring social), navigation flows management (Spring Webflow) and others.

但是,说 Java EE 涵盖了 Spring 所做的所有领域是不正确的。在我看来,如果您在特定领域工作,例如移动 (Spring mobile)、社交 (Spring social)、导航流管理 (Spring Webflow) 等,Spring 仍然有一些可以发挥作用的东西。