SpringBoot是什么, 如何入门, 使用方法和错误解决方案
SpringBoot是什么
一个快速,高效搭建spring项目的框架
为什么要用SpringBoot
1.搭建项目的配置文件太多
2.项目的依赖管理比较麻烦
3.偷懒是程序员的一种至高境界
怎么使用SpringBoot
SpringBoot入门案例
1.打开idea2019创建一个空的maven工程
2.在pom.xml文件中导入springboot的依赖父工程坐标和web启动器
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fun.mingju.springboot</groupId>
<artifactId>springboot01</artifactId>
<version>1.0-SNAPSHOT</version>
<!--父工程坐标-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
</parent>
<dependencies>
<!--web启动器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
3.创建启动类StartApplication和编写HelloController
4.运行启动类StartApplication
5.在浏览器里面输入http://localhost:8080/hello
未完待续……
更多精彩分享,请访问个人博客Mingju’s Lab。