Java ASP.NET MVC 与 Spring MVC

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

ASP.NET MVC vs Spring MVC

java.netasp.net-mvccomparisonspring-mvc

提问by sirmak

Can anyone please make a comparison of ASP.NET MVCvs Spring MVC.

任何人都可以比较ASP.NET MVCvs Spring MVC.

Which technology is better in performance, productivity, maintenance, features,...

哪种技术在性能、生产力、维护、功能、...

Regards, sirmak

问候,西尔马克

采纳答案by Nate

It's hard to say which one is "better"....

很难说哪个“更好”......

First - there's the whole underlying "Java vs. .NET" argument - you can't really compare the frameworks ignoring this.

首先 - 存在整个潜在的“Java vs. .NET”论点 - 你无法真正比​​较忽略这一点的框架。

The whole history of web development in Java with "heavyweight" J2EE apps vs. "lightweight" Spring apps. That in Java there are a ton of web frameworks (MVC and not, open-source vs. Sun-developed) and that Spring MVC had a lot to be based on.

使用“重量级”J2EE 应用程序与“轻量级”Spring 应用程序使用 Java 进行 Web 开发的整个历史。在 Java 中有大量的 Web 框架(MVC 而不是,开源与 Sun 开发的),并且 Spring MVC 有很多基础。

And on the ASP.NET MVC side - the whole history of ASP -> ASP.NET -> ASP.NET MVC. And the lack of widely-usednon-Microsoft .NET frameworks - web or otherwise.

在 ASP.NET MVC 方面 - ASP -> ASP.NET -> ASP.NET MVC 的整个历史。并且缺乏广泛使用的非 Microsoft .NET 框架 - 网络或其他。

Now into the opinionated part...

现在进入自以为是的部分......

I'm somewhat the opposite of @Luke101 as I've worked mostly with Spring MVC and very little with ASP.NET MVC.

我与@Luke101 有点相反,因为我主要使用 Spring MVC,很少使用 ASP.NET MVC。

I have to say I prefer MVC-style web development over component-based web development.

我不得不说,相比基于组件的 Web 开发,我更喜欢 MVC 风格的 Web 开发。

I have worked with JSF, which is similar to ASP.NET webforms. (I have to say I liked ASP.NET more than JSF - though this probably has more to do with the maturity of each framework when I used it, and tools available - I used JSF 1.0/1.1 and just Eclipse with no JSF specific support vs. ASP.NET 2.0/.NET 3.5 with Visual Studio 2008.)

我使用过类似于 ASP.NET webforms 的 JSF。(我不得不说我比 JSF 更喜欢 ASP.NET - 尽管这可能与我使用它时每个框架的成熟度以及可用工具有关 - 我使用了 JSF 1.0/1.1 和没有 JSF 特定支持的 Eclipse与使用 Visual Studio 2008 的 ASP.NET 2.0/.NET 3.5。)

As far as MVC frameworks I prefer Spring MVC - but that's entirely because I'm just more familiar with Java - language-wise and development-wise, as opposed to ASP.NET MVC / C# /.NET. Also, Spring MVC requires Spring, and I like to develop using Spring's whole IOC pattern and use things already integrated into Spring.

至于 MVC 框架,我更喜欢 Spring MVC——但这完全是因为我更熟悉 Java——语言和开发方面,而不是 ASP.NET MVC/C#/.NET。另外,Spring MVC 需要 Spring,我喜欢使用 Spring 的整个 IOC 模式进行开发,并使用已经集成到 Spring 中的东西。

I haven't tried using Spring.NET and ASP.NET MVC - maybe this would be similar to Spring MVC / Spring / Java.

我还没有尝试过使用 Spring.NET 和 ASP.NET MVC - 也许这类似于 Spring MVC / Spring / Java。

In the Spring.NET repo there are some examples of integrating Spring.NET into ASP.NET MVC version 3, version 4and version 5.

在 Spring.NET 存储库中有一些将 Spring.NET 集成到 ASP.NET MVC版本 3版本 4版本 5 的示例。

回答by user161433

ASP.NET MVC is pretty young but very powerful and fast. I have rewritten all my web applications from webforms to asp.net MVC. I have seen a noticable difference in the cpu utilization and the amount of ram being used. I think if I built my projects from scratch in MVC it would take a little longer then in webforms.

ASP.NET MVC 很年轻但是非常强大和快速。我已经将我所有的 web 应用程序从 webforms 重写为 asp.net MVC。我已经看到 CPU 利用率和使用的 ram 数量存在显着差异。我想如果我在 MVC 中从头开始构建我的项目,那么在 webforms 中需要的时间会更长一些。

I really can't comment on spring as I have never used it. But, here is an interesting discussion on the whole java and microsoft thing.

我真的无法评论 spring,因为我从未使用过它。但是,这里有一个关于整个 java 和 microsoft 的有趣讨论。

http://philip.greenspun.com/bboard/q-and-a-fetch-msg?msg_id=000tcP

http://philip.greenspun.com/bboard/q-and-a-fetch-msg?msg_id=000tcP

回答by kilonet

I've tried both Spring and ASP.NET MVC frameworks. I found ASP.NET MVC easier to use, mainly because of significantly less configuration code (both xml and java/c#) in ASP.NET framework required to get things worked. In Spring you can get all the features ASP.NET MVC has by default, but be prepared to write many xml/java configuration code and maybe use some third party tools.

我已经尝试过 Spring 和 ASP.NET MVC 框架。我发现 ASP.NET MVC 更易于使用,主要是因为在 ASP.NET 框架中使事情工作所需的配置代码(xml 和 java/c#)显着减少。在 Spring 中,您可以获得默认情况下 ASP.NET MVC 的所有功能,但要准备好编写许多 xml/java 配置代码,并且可能会使用一些第三方工具。

Among strong benefits of Spring are integrated IoC, ORM (mainly Hibernate for me) and transaction managment support.

Spring 的强大优势包括集成 IoC、ORM(对我来说主要是 Hibernate)和事务管理支持。

回答by Kevin Hakanson

Here's a PDF I found titled Comparision Between Spring and ASP.NET Frameworks, but I don't agree with some of the ASP.NET MVC comments like:

这是我找到的名为Comparision between Spring and ASP.NET Frameworks的 PDF ,但我不同意 ASP.NET MVC 的一些评论,例如:

  • Offers only one view format (.aspx pages)
  • Tight coupling between URL and Class action name
  • 仅提供一种视图格式(.aspx 页面)
  • URL 和类操作名称之间的紧耦合

It appears to be a quickly done slide deck for a university course, and not something by someone that has developed in each framework.

它似乎是一个快速完成的大学课程幻灯片,而不是在每个框架中开发的人的东西。

回答by ninja

This question has been around for a couple years, but I think you guys should stop thinking in terms of who is more familiar with asp or Java. In todays world it doesnt matter, I can hire a few code monkey's like us anywhere or I for example can write in both and anyone can pick up either in a matter of days, I think in a large scale scenario, what matters more is what is affordable, hosting on Windows/asp platform or Linux/Java, sure the easy of technology matters, but we arent comparing C programming to Java. I guess everyone agree they both are competing technologies. What do you rather invest into? Questions to that nature. For example I think hosting on a linux platform will be cheaper.

这个问题已经存在好几年了,但我认为你们应该停止思考谁更熟悉 asp 或 Java。在当今世界,没关系,我可以在任何地方雇用一些像我们这样的代码猴子,或者我可以同时编写,任何人都可以在几天内拿起其中之一,我认为在大规模场景中,更重要的是什么价格实惠,托管在 Windows/asp 平台或 Linux/Java 上,当然技术的简单性很重要,但我们不会将 C 编程与 Java 进行比较。我想每个人都同意它们都是相互竞争的技术。你更愿意投资什么?对这种性质的问题。例如,我认为在 linux 平台上托管会更便宜。