最近,在学习Spring boot,记录一点学习过程,使用IDEA创建。

1.打开IDEA,创建新项目,选择Spring Initializr

使用IDEA创建第一个SpringBoot项目

 2.输入Artifact

使用IDEA创建第一个SpringBoot项目

3.勾选Web

使用IDEA创建第一个SpringBoot项目

4.点击finish完成

使用IDEA创建第一个SpringBoot项目

5.进入项目,可以将以下内容删除

使用IDEA创建第一个SpringBoot项目

6.创建一个HelloController

package com.example.springboot;
 
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
//返回json格式数据
@RestController
public class helloController {
 
    @RequestMapping("/hello")
    public String hello() {
        return "hello,this is a springboot demo !";
    }
}

7.运行SpringbootApplication类

使用IDEA创建第一个SpringBoot项目

8.测试

在地址栏中输入http://localhost:8080/hello

使用IDEA创建第一个SpringBoot项目

ok!!!

 

相关文章:

  • 2021-12-04
  • 2021-08-07
  • 2021-07-12
  • 2022-12-23
  • 2021-06-06
  • 2022-01-31
猜你喜欢
  • 2021-12-04
  • 2021-10-21
  • 2021-08-02
  • 2021-12-02
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案