Intellij IDEA创建spring-boot项目的图文教程

2025-05-27 0 85

开发环境:

  • jdk版本:jdk8 
  • maven版本:maven-3.5.2  
  • 开发工具:itellij idea 2017.1

前提条件:已安装以上软件并配置好jdk和maven的环境变量

创建步骤:

点击坐上角file —》选择new —》点击project… 如下图所示:

Intellij IDEA创建spring-boot项目的图文教程

点击左边spring initializr —》 右上角新建jdk(若有则不需要) —》 点击next 如下图所示:

Intellij IDEA创建spring-boot项目的图文教程

看需求修改下图中的信息后点击next(可以直接使用默认)

Intellij IDEA创建spring-boot项目的图文教程

点击左边的web —》 选中中间列的web —》 点击next 如下图所示:

Intellij IDEA创建spring-boot项目的图文教程

输入项目名称和保存路径 — 》点击finish

Intellij IDEA创建spring-boot项目的图文教程

创建的项目如下图所示:

Intellij IDEA创建spring-boot项目的图文教程

创建hellocontroller类,代码如下所示:

?

1

2

3

4

5

6

7

8

9

10

11
package com.example.demo.controller;

import org.springframework.web.bind.annotation.requestmapping;

import org.springframework.web.bind.annotation.restcontroller;

@restcontroller

@requestmapping("/hello")

public class hellocontroller {

@requestmapping("/say")

public string sayhello() {

return "hello world";

}

}

执行demoapplication中main方法后访问 http://localhost:8080/hello/say页面如下所示:

Intellij IDEA创建spring-boot项目的图文教程

总结

以上所述是小编给大家介绍的intellij idea创建spring-boot项目的图文教程,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

原文链接:https://www.cnblogs.com/guohaien/p/8317962.html

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

快网idc优惠网 建站教程 Intellij IDEA创建spring-boot项目的图文教程 https://www.kuaiidc.com/76595.html

相关文章

发表评论
暂无评论