IDEA创建Spring Boot项目

IDEA创建Spring Boot项目,第1张

作者(Author):幻想 链接(URL):https://5hx.ink/?p=118 来源(Source):Hx`s Blog

创建SpringBoot项目

简单测试一下

创建Spring Boot项目

①打开IDEA,选择New Project(新建项目)

②选择Spring Initializr -> 选择自己的java版本 -> 选择默认的官网导入即可 -> 点击next

若使用默认源显示

将Custom换成阿里源即可(https://start.aliyun.com/)

③配置项目信息

④选择Spring Web依赖,一直next,出现代码页就创建完成啦

简单测试一下

创建controller包,在包下面创建一个class

package com.fantasy.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloSpring {
    @RequestMapping("/hello")
    public String demo(){
        return "Hello Spring";
    }
}

启动项目,访问localhost:8080/hello查看

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/796522.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-06
下一篇 2022-05-06

发表评论

登录后才能评论

评论列表(0条)

保存