怎么在Idea2019中创建一个Spingboot Web项目

怎么在Idea2019中创建一个Spingboot Web项目?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

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

2、File > Peoject

3、Spring Initializr:

怎么在Idea2019中创建一个Spingboot Web项目

怎么在Idea2019中创建一个Spingboot Web项目

怎么在Idea2019中创建一个Spingboot Web项目

怎么在Idea2019中创建一个Spingboot Web项目

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;

@RestController
public 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等。

看完上述内容,你们掌握怎么在Idea2019中创建一个Spingboot Web项目的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!