第一个Spring Boot应用程序

1、创建项目

这里我们使用idea 来新建一个SpringBoot 项目。

Spring初始化器

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
新建controol层
在这里插入图片描述

package com.kcbg.hellospringboot.controller;

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

/**
 * @program: hello-spring-boot
 * @description: 你好SpringBoot
 * @author: MW
 * @create: 2020-06-12 19:13
 **/
@RestController
public class HelloSpringBoot {
    @GetMapping("/hello")
    public String sayHi(){
        return "你好SpringBoot";
    }

}

把application后缀修改成yml格式的快捷键(Shift+F6)再指定一个端口号

在这里插入图片描述
启动项目访问
http://localhost:8082/hello
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42222342/article/details/106722167