欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2023-12-13 22:25:58
开发环境: jdk版本:jdk8  maven版本:maven-3.5.2   开发工具:itellij idea 2017.1 前提条件:已安...

开发环境:

  • 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类,代码如下所示:

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方法后访问 页面如下所示:

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

总结

以上所述是小编给大家介绍的intellij idea创建spring-boot项目的图文教程,希望对大家有所帮助

上一篇:

下一篇: