springboot系列1 快速创建Hello World

一、环境准备

  • jdk
  • maven
  • idea

二、 打开IDEA

1.新建项目

在这里插入图片描述

2.选择Spring Initializr

在这里插入图片描述

3.配置项目属性

  • 项目名称
  • 包名
    Java version选择自己电脑对应的版本
    在这里插入图片描述

4. 选择Spring Web组件

在这里插入图片描述

5.编写Controller

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @GetMapping("hello")
    public String hello(){
        return "hello world!";
    }
}


6.运行项目,在浏览器访问

运行xxxApplication(xxx为自己项目对应的名称)
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/dabaoting/article/details/114012848