美文网首页
SpringBoot的第一个起步练习

SpringBoot的第一个起步练习

作者: 寂川_b645 | 来源:发表于2019-03-18 18:23 被阅读0次

1.Springboot简单上手视频

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

相关文章

网友评论

      本文标题:SpringBoot的第一个起步练习

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