重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

IntellijIDEA如何创建spring-boot项目

这篇文章将为大家详细讲解有关Intellij IDEA如何创建spring-boot项目,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

双牌网站建设公司成都创新互联公司,双牌网站设计制作,有大型网站制作公司丰富经验。已为双牌近千家提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的双牌做网站的公司定做!

开发环境:

  • 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方法后访问http://localhost:8080/hello/say 页面如下所示:

Intellij IDEA如何创建spring-boot项目

关于“Intellij IDEA如何创建spring-boot项目”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


文章名称:IntellijIDEA如何创建spring-boot项目
网页网址:http://cqcxhl.cn/article/gsdesg.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP