美文网首页
2019-03-18

2019-03-18

作者: 诅咒猎豹 | 来源:发表于2019-03-18 20:49 被阅读0次

SpringBoot的第一个起步练习

对字符编码进行配置
<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

相关文章

网友评论

      本文标题:2019-03-18

      本文链接:https://www.haomeiwen.com/subject/hdcimqtx.html