Spring MVC和Spring Boot有什么区别?

分不太清它们俩的区别,我只知道SpringBoot比SpringMVC少了很多配置,像是少了web.xml。然后自带tomcat,Spring Boot的项目不用搭建一个tomcat服务器。

阅读 10.2k
3 个回答

SpringMVC:

Spring Web MVC is the original web framework built on the Servlet API and included in the Spring Framework from the very beginning. The formal name "Spring Web MVC" comes from the name of its source module spring-webmvc but it is more commonly known as "Spring MVC".

Spring boot:

Spring Boot makes it easy to create stand-alone, production-grade Spring-based Applications that you can run. We take an opinionated view of the Spring platform and third-party libraries, so that you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

从简介我们看出两者定位其实不同,SpringMVC是MVC框架,Spring Boot是为了让你快速开发基于Spring 应用.Spring Boot 通过stater的方式简化整个Spring生态配置, 比如你题中提到的SpringMVC, 对应的starter就是spring-boot-starter-web, 从开发体验上来说就是你提到的,没有很多xml配置,并内置了tomcat.

最大的区别个人觉得还是不用搭服务器,方便部署。
当然spring boot占用的资源也比spring mvc多

推荐问题
宣传栏