快速构建SpringBoot项目的两种方发
一、 通过 http://start.spring.io/ 在线构建
二、 通过IntelliJ IDEA 快速构建
通过 http://start.spring.io/ 在线构建
选择group,artifact,dependencies 之后 点击 Generate Project ,会下载下来一个 压缩包,
解压之后,通过IDE 打开 ,按需配置开发。
这个在上一篇文章中已经用过,不再详细叙述。
通过IntelliJ IDEA 快速构建
使用 idea 创建一个项目 File ——>>>New ——>>> Project... ——>>> Spring Assistant --->>> (默认会以最新发布版构建 )next
我们这里选择Web 依赖,其它需要可根据自身需要进行选择
点击Next 选择保存位置,打开,,, 目录结构大致是这
然后我们新建SampleController ,写一个 Hello World
package com.zyzx.sample1;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SimpleController {
@RequestMapping("/test")
public String test(){
return "hello world";
}
}
启动运行并测试