2019-03-18

2019-03-18  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读