spring boot 第一篇 spring boot 和spring mvc 的区别

1.什么是spring boot?官网给出的介绍是:

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

2.spring boot的特性
官网的说明如下

Features
1.Create stand-alone Spring applications
创建独立的spring 应用
2.Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
内置tomcat, jetty,Undertow等服务器,不需要发布war包
3.Provide opinionated ‘starter’ dependencies to simplify your build configuration
基于约定优于配置原则提供starter依赖组件,用来简化配置
4.Automatically configure Spring and 3rd party libraries whenever possible
自动装配spring 或者第三方组件
5.Provide production-ready features such as metrics, health checks, and externalized configuration
提供生产环境可用的健康检查,外部化配置等,基于actuator 监控
6.Absolutely no code generation and no requirement for XML configuration
去xml配置化,完全基于注解

一. spring mvc 开发流程
1.创建maven webapp项目,导入依赖包
spring boot 第一篇 spring boot 和spring mvc 的区别

2.在web.xml配置servlet
spring boot 第一篇 spring boot 和spring mvc 的区别

3.在mvc的配置文件里配置包扫描路径,开启注解驱动,定义视图解析器
spring boot 第一篇 spring boot 和spring mvc 的区别

4.写业务逻辑代码Controller,打包成war包,部署到外部的tomcat等服务器供外部访问

二. spring boot 开发流程
1.创建maven 项目,导入依赖的包
spring boot 第一篇 spring boot 和spring mvc 的区别

  1. 创建启动类,添加 @SpringBootApplication注解 ,之后开发业务代码,打包成jar包,或者直接启动main函数,供外界访问。因为spring boot 内置了tomcat服务器,所以不需要部署。
    spring boot 第一篇 spring boot 和spring mvc 的区别
    以上分析可以看到spring boot 对一些模板类的操作做了封装,完全去除了xml配置。使得开发更加简单,用户只需要注意业务逻辑,也减轻了后期维护xml配置的成本。
    spring mvc 是spring 提供的一个组件
    spring boot 相当于一个快速开发spring 应用的脚手架,是基于spring的更高级的封装
    我觉得这篇文章解释的比较清楚
    https://www.cnblogs.com/ThinkVenus/p/8026633.html