Springboot(一)——Springboot快速入门

Springboot快速入门

第一个springboot程序Hello,World

我们将学习如何快速的创建一个Spring Boot应用,并且实现一个简单的Http请求处理。通过这个例子对Spring Boot有一个初步的了解,并体验其结构简单、开发快速的特性。

我的环境准备:

  • java11
  • Maven-3.6.3
  • SpringBoot 2.x 最新版

开发工具:

  • IDEA

一、创建Springboot项目

image

建议把服务连接换成阿里云的:https://start.aliyun.com/
image

二、添加SpringWeb框架,再点击完成

image

三、可以选择删除多余文件

image

四、等待项目下载完成

image

五、springboot主启动类,springboot从这里开始跑

image

六、新建controller包

image

七、在controller包下新建HelloWorld类

package com.study.springboot01helloworld.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController

public class HelloWorld {
    @RequestMapping("/hello")
    public String HelloWorld01(){
        return "HelloWorld";
    }
}

image

八、在Springboot主启动类启动项目

image

九、项目启动完成

1、启动完成提示
image

2、在网页中输入localhost:8080
image

3、在网页中输入localhost:8080/hello
image

posted @ 2021-06-28 08:27  转身刹那的潇洒  阅读(205)  评论(0编辑  收藏  举报