一、打开网站
二、设置选项

选择完成后点击生成按钮,会得到一个压缩包,选择解压。

三、使用IDEA导入解压文件
删除不必要的东西,得到如下:

四、简单测试
4.1、在MassimoApplication同级目录下新建包controller
4.2、在controller中创建类HelloController
package com.example.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello(){
return "hello,World";
}
}
4.3、打开浏览器,输入http://localhost:8080/hello

4.4、总体目录结构

本文详细介绍如何通过生成官网快速搭建SpringBoot项目,并利用IDEA进行项目导入与简化。此外,还介绍了创建HelloController类来实现基本的RESTful API功能,并通过浏览器验证其正确性。
256

被折叠的 条评论
为什么被折叠?



