SpringBoot的第一个起步练习
- 百度云链接链接:https://pan.baidu.com/s/1qIjjqwQuPHrxeGy-iV55mA
提取码:322d
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运行效果图

网友评论