我刚刚开始学习春天。在我的下一步,我想开发更大的网络应用程序。
现在我想知道我是否应该从Spring Boot或Spring MVC开始。我已经读了一些东西,但这是令人困惑的,因为两者看起来相似。
那么两者之间有什么不同呢?
我刚刚开始学习春天。在我的下一步,我想开发更大的网络应用程序。
现在我想知道我是否应该从Spring Boot或Spring MVC开始。我已经读了一些东西,但这是令人困惑的,因为两者看起来相似。
那么两者之间有什么不同呢?
当前回答
补充一点,Java Spring是一个框架,而Java Spring Boot是附加的,通过提供预配置和易于使用的组件来加速它。 总是建议在跳到Java Spring Boot之前了解Java Spring的基本概念。
其他回答
补充一点,Java Spring是一个框架,而Java Spring Boot是附加的,通过提供预配置和易于使用的组件来加速它。 总是建议在跳到Java Spring Boot之前了解Java Spring的基本概念。
简单来说,它可以表述为:
Spring boot = Spring MVC +自动配置(不需要编写Spring .xml文件进行配置)+服务器(您可以有嵌入式Tomcat, Netty, Jetty服务器)。
Spring Boot是一个opiniated框架,因此它的构建考虑到了开发速度快,配置时间短,并且有很好的社区支持。
Spring MVC is a complete HTTP oriented MVC framework managed by the Spring Framework and based in Servlets. It would be equivalent to JSF in the JavaEE stack. The most popular elements in it are classes annotated with @Controller, where you implement methods you can access using different HTTP requests. It has an equivalent @RestController to implement REST-based APIs. Spring boot is a utility for setting up applications quickly, offering an out of the box configuration in order to build Spring-powered applications. As you may know, Spring integrates a wide range of different modules under its umbrella, as spring-core, spring-data, spring-web (which includes Spring MVC, by the way) and so on. With this tool you can tell Spring how many of them to use and you'll get a fast setup for them (you are allowed to change it by yourself later on).
因此,Spring MVC是一个用于web应用程序的框架,Spring Boot是一个基于Spring的生产就绪项目初始化器。您可能会发现访问Spring MVC标记wiki以及SO中的Spring Boot标记wiki很有用。
SpringBoot实际上是预配置的,减少了锅炉配置,并提供了最简单或快速的方式来启动应用程序。
SpringBoot将令人头痛的配置问题从开发人员转移到它自己,而不是Spring。
隐式SpringBoot基于Spring框架概念,如bean、控制器、服务、jpa等。
可以说SpringBoot是Spring的包装器。
在SpringBoot中,服务器的默认端口是8080,但如果你想改变,那就去你的应用程序。属性和写入
server.port = 8084
这样想:
Spring MVC是一个基于web实现MVC架构的框架。
Spring Boot是一个面向程序员的工具。程序员必须专注于编程,工具必须专注于配置。所以我们不需要浪费时间配置一堆xml来创建一个简单的“Hello world”。