一、SpringBoot介绍
1.1 SpringBoot简介
1.2 SpringBoot的特点
1.3 SpringBoot的核心功能
二、SpringBoot介绍
三、SpringBoot快速入门
项目创建完成!
此时pom.xml文件中会自动导入springboot所需依赖,并且在src下会生成一个配置类。
注意:若pom.xml中依赖无法下载,需要修改maven工程对应的settings.xml文件,找到settings.xml文件中的镜像配置,原因是maven中央仓库下载不下来springboot关联的架包,所以建议使用阿里云的镜像.
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The
repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror.
IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
-->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
此时pom.xml文件中会自动导入springboot所需依赖,并且在src下会生成一个配置类。
注意:若pom.xml中依赖无法下载,需要修改maven工程对应的settings.xml文件,找到settings.xml文件中的镜像配置,原因是maven中央仓库下载不下来springboot关联的架包,所以建议使用阿里云的镜像.
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors></pre>
手动编写Controller进行进一步测试(注意:需要将controller类,放在启动类的子包中或者同级包下)
package com.qf.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class UserController {
@RequestMapping("/login")
public String login(){
System.out.println("登录");
return "success";
}
}
四、SpringBoot热部署配置
<!--热部署配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>