原创

使用IDEA安装springboot框架

温馨提示:
本文最后更新于 2021年04月06日,已超过 1,115 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

点击 File->New->Project 创建新项目:

选择spring Initializr:

仙士可博客

点击next 进行下一步:

仙士可博客

仙士可博客

仙士可博客

点击完成之后打开项目:

仙士可博客

点击右侧的maven图标,点击同步按钮,下载需要的依赖:

仙士可博客

如果下载慢,可以切换maven镜像进行下载

编写Index控制器

package com.example.tioncico.controller;

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

@RestController
public class IndexController {
    @RequestMapping("/index")
    public String index(){
        return "hello world";
    }
}

通过右上角的启动命令,一键编译+启动:

仙士可博客

访问 http://localhost:8080/index  (默认端口)

仙士可博客

启动成功

正文到此结束
本文目录