一、Spring boot简介
Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。其实它就是一套集成好的类库,将平时搭建Spring MVC 的依赖都集成在一起,并以一种简单的约定将其运行起来。
- Create stand-alone Spring applications
- Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
- Provide opinionated ‘starter’ dependencies to simplify your build configuration
- Automatically configure Spring and 3rd party libraries whenever possible
- Provide production-ready features such as metrics, health checks and externalized configuration
- Absolutely no code generation and no requirement for XML configuration
官网描述有5个特性:
- 能独立运行的Spring应用
- 内嵌Tomcat、Jetty或者Undertow (无需WAR包)
- 提供自用的start依赖去简化你的开发环境搭建
- 尽可能自动配置Spring和第三方的类库
- 没有代码生成,也无需XML配置。
二、搭建开发环境
下载项目
我们访问官网的quick start:https://start.spring.io/
写好自己项目的GA(Group Artifact),点击Generate project,如图所示
然后,我们会得到一个压缩包。解压后,我们将项目导入IDE,我们的第一步就完成了。
配置依赖
在pom.xml文件里面加入
1 | <dependency> |