首页 > 编程 > Java > 正文

Idea2019创建Spingboot Web项目的方法步骤

2019-11-26 08:30:42
字体:
来源:转载
供稿:网友

1、Idea及Java版本:Idea2019.1 + jdk1.8

2、File > Peoject

3、Spring Initializr:

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

4、之后会自动下载需要的相关文件

5、src > main > com.xxx.xxx下创建HelloController,内容如下:

package com.weihua.xxx;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class HelloController {   @RequestMapping(value = "/hello", method = RequestMethod.GET)   public String helloWorld () {      return "Hello World !";   }}

6、运行XxxApplication,在浏览器窗口输入http://localhost:8080/hello,页面显示:Hello World !

7、src > main > resources > static下存放静态资源文件如html、js、css等。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表