1.Springboot简单上手视频
- 百度云链接:https://pan.baidu.com/s/1QAheAceNPf9FbxvWHbb-nw
- 提取码:w6vw
2.视频内代码
2.1.pom.xml内
- 对字符编码进行配置
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding> - 额外添加依赖包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> - java代码
HelloController.java
package com.springboot.quickstart.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/** springboot的第一个restful请求 */
@RestController
public class HelloController {
@RequestMapping(value = "/hello",method = RequestMethod.GET)
public String getHello(){
return "Hello,Spring Boot~~";
}
}
2.2运行效果图
image.png